mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
Factor out repeated queue processor identification
This commit is contained in:
parent
f553469944
commit
d7bb97ae05
@ -938,6 +938,11 @@ class Uploader(QueueMixin):
|
|||||||
def __init__(self, client, local_path_u, db, upload_dirnode, pending_delay, clock):
|
def __init__(self, client, local_path_u, db, upload_dirnode, pending_delay, clock):
|
||||||
QueueMixin.__init__(self, client, local_path_u, db, u'uploader', clock)
|
QueueMixin.__init__(self, client, local_path_u, db, u'uploader', clock)
|
||||||
|
|
||||||
|
self._log_fields = dict(
|
||||||
|
nickname=self._client.nickname,
|
||||||
|
direction=self._name,
|
||||||
|
)
|
||||||
|
|
||||||
self.is_ready = False
|
self.is_ready = False
|
||||||
|
|
||||||
if not IDirectoryNode.providedBy(upload_dirnode):
|
if not IDirectoryNode.providedBy(upload_dirnode):
|
||||||
@ -971,10 +976,7 @@ class Uploader(QueueMixin):
|
|||||||
recursive=False)#True)
|
recursive=False)#True)
|
||||||
|
|
||||||
def start_monitoring(self):
|
def start_monitoring(self):
|
||||||
action = START_MONITORING(
|
action = START_MONITORING(**self._log_fields)
|
||||||
nickname=self._client.nickname,
|
|
||||||
direction=self._name,
|
|
||||||
)
|
|
||||||
with action.context():
|
with action.context():
|
||||||
d = DeferredContext(defer.succeed(None))
|
d = DeferredContext(defer.succeed(None))
|
||||||
|
|
||||||
@ -984,10 +986,7 @@ class Uploader(QueueMixin):
|
|||||||
return d.addActionFinish()
|
return d.addActionFinish()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
action = STOP_MONITORING(
|
action = STOP_MONITORING(**self._log_fields)
|
||||||
nickname=self._client.nickname,
|
|
||||||
direction=self._name,
|
|
||||||
)
|
|
||||||
with action.context():
|
with action.context():
|
||||||
self._notifier.stopReading()
|
self._notifier.stopReading()
|
||||||
self._count('dirs_monitored', -1)
|
self._count('dirs_monitored', -1)
|
||||||
@ -1006,10 +1005,7 @@ class Uploader(QueueMixin):
|
|||||||
return d.addActionFinish()
|
return d.addActionFinish()
|
||||||
|
|
||||||
def start_uploading(self):
|
def start_uploading(self):
|
||||||
action = START_UPLOADING(
|
action = START_UPLOADING(**self._log_fields)
|
||||||
nickname=self._client.nickname,
|
|
||||||
direction=self._name,
|
|
||||||
)
|
|
||||||
with action:
|
with action:
|
||||||
self.is_ready = True
|
self.is_ready = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user