[packagekit] Yum and locking
Tim Lauridsen
tla at rasmil.dk
Thu Oct 18 22:54:48 PDT 2007
Robin Norwood wrote:
> Tim Lauridsen <tla at rasmil.dk> writes:
>
>
>>> The still is needing some signal catching to work with the abort case.
>>>
>>>
>> i have added some code so yum is unlocked on SIGQUIT, but i don't know
>> to test it.
>>
>
> Cool. However, it looks like the way things are now it will just abort
> if something else has the lock - shouldn't we wait around awhile, and
> perhaps notify PK with a signal?
>
> So instead of:
>
> def doLock(self):
> ''' Lock Yum'''
> if not self.isLocked():
> try: # Try to lock yum
> self.yumbase.doLock( YUM_PID_FILE )
> PackageKitBaseBackend.doLock(self)
> except:
> self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')
>
> We do something like:
>
> def doLock(self):
> ''' Lock Yum'''
> retries = 0
> while not self.isLocked():
> try: # Try to lock yum
> self.yumbase.doLock( YUM_PID_FILE )
> PackageKitBaseBackend.doLock(self)
> except:
> sleep(6)
> retries++
> if retries > 100:
> self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')
>
>
> What do you think?
>
Look fine, i have commit a slightly modified edition (2s delay &
submitting a wait signal)
> Also, looking at yumBackend.py, I'm a little confused now - it looks
> like there are two sets of lock/unlock code: do(Un)Lock and
> _(un)lock_yum. I can't really see why there are two different sets of
> methods...
>
> -RN
>
Some old code for a first try on locking, i missed to clean it up, it
should be gone now :)
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20071019/c5a162f1/attachment-0004.htm>
More information about the PackageKit
mailing list