Update of /cvsroot/mailman/mailman/Mailman/Archiver
In directory usw-pr-cvs1:/tmp/cvs-serv26655
Modified Files:
Tag: Release_2_0_1-branch
HyperArch.py
Log Message:
GetArchLock(), DropArchLock(): Steal these implementations from
Mailman 2.1 since the old versions were based on posixfile, which is a
deprecated module. It's better to have all the locking under one roof
anyway.
Index: HyperArch.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/HyperArch.py,v
retrieving revision 1.46
retrieving revision 1.46.2.1
diff -C2 -d -r1.46 -r1.46.2.1
*** HyperArch.py 13 Nov 2000 21:50:05 -0000 1.46
--- HyperArch.py 2 Apr 2002 23:39:35 -0000 1.46.2.1
***************
*** 40,48 ****
import pickle
import os
- import posixfile
import HyperDatabase
import pipermail
! from Mailman import mm_cfg, EncWord
from Mailman.Logging.Syslog import syslog
--- 40,49 ----
import pickle
import os
import HyperDatabase
import pipermail
! from Mailman import mm_cfg
! from Mailman import LockFile
! from Mailman import EncWord
from Mailman.Logging.Syslog import syslog
***************
*** 700,717 ****
if self._lock_file:
return 1
! # TBD: This needs to be rewritten to use the generalized locking
! # mechanism (when that exists). -baw
! ou = os.umask(0)
try:
! self._lock_file = posixfile.open(
! os.path.join(mm_cfg.LOCK_DIR, '[EMAIL PROTECTED]'
! % self.maillist.internal_name()), 'a+')
! finally:
! os.umask(ou)
! # minor race condition here, there is no way to atomicly
! # check & get a lock. That shouldn't matter here tho' -ddm
! if not self._lock_file.lock('w?', 1):
! self._lock_file.lock('w|', 1)
! else:
return 0
return 1
--- 701,710 ----
if self._lock_file:
return 1
! self._lock_file = LockFile.LockFile(
! os.path.join(mm_cfg.LOCK_DIR,
! self.maillist.internal_name() + '-arch.lock'))
try:
! self._lock_file.lock(timeout=0.5)
! except LockFile.TimeOutError:
return 0
return 1
***************
*** 719,724 ****
def DropArchLock(self):
if self._lock_file:
! self._lock_file.lock('u')
! self._lock_file.close()
self._lock_file = None
--- 712,716 ----
def DropArchLock(self):
if self._lock_file:
! self._lock_file.unlock(unconditionally=1)
self._lock_file = None
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins