mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-22 18:22:40 +00:00
pull this up and use it more
This commit is contained in:
parent
15601a37e9
commit
437084c300
@ -813,6 +813,10 @@ class QueueMixin(HookMixin):
|
|||||||
self._db = db
|
self._db = db
|
||||||
self._name = name
|
self._name = name
|
||||||
self._clock = clock
|
self._clock = clock
|
||||||
|
self._log_fields = dict(
|
||||||
|
nickname=self._client.nickname,
|
||||||
|
direction=self._name,
|
||||||
|
)
|
||||||
self._hooks = {
|
self._hooks = {
|
||||||
'processed': None,
|
'processed': None,
|
||||||
'started': None,
|
'started': None,
|
||||||
@ -863,10 +867,7 @@ class QueueMixin(HookMixin):
|
|||||||
"""
|
"""
|
||||||
Start a loop that looks for work to do and then does it.
|
Start a loop that looks for work to do and then does it.
|
||||||
"""
|
"""
|
||||||
action = PROCESSING_LOOP(
|
action = PROCESSING_LOOP(**self._log_fields)
|
||||||
nickname=self._client.nickname,
|
|
||||||
direction=self._name,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Note that we don't put the processing iterations into the logging
|
# Note that we don't put the processing iterations into the logging
|
||||||
# action because we expect this loop to run for the whole lifetime of
|
# action because we expect this loop to run for the whole lifetime of
|
||||||
@ -887,10 +888,7 @@ class QueueMixin(HookMixin):
|
|||||||
One iteration runs self._process_deque which calls _perform_scan() and
|
One iteration runs self._process_deque which calls _perform_scan() and
|
||||||
then completely drains the _deque (processing each item).
|
then completely drains the _deque (processing each item).
|
||||||
"""
|
"""
|
||||||
action = ITERATION(
|
action = ITERATION(**self._log_fields)
|
||||||
nickname=self._client.nickname,
|
|
||||||
direction=self._name,
|
|
||||||
)
|
|
||||||
with action.context():
|
with action.context():
|
||||||
d = DeferredContext(defer.Deferred())
|
d = DeferredContext(defer.Deferred())
|
||||||
|
|
||||||
@ -1051,11 +1049,6 @@ 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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user