Skip to content

Commit 2ae44da

Browse files
committed
Core: Ensures SMS spooler triggers on onegov.core.utils.safe_move
Previously we still triggered because we didn't ignore `.tmp` files, so this bug was obscured. TYPE: Bugfix
1 parent 132775d commit 2ae44da

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: src/onegov/core/cli/commands.py

+17
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,23 @@ def __init__(self, queue_processors: list[SmsQueueProcessor]):
187187
ignore_directories=True
188188
)
189189

190+
def on_moved(self, event: 'FileSystemEvent') -> None:
191+
dest_path = os.path.abspath(event.dest_path)
192+
for qp in self.queue_processors:
193+
# only one queue processor should match
194+
if dest_path.startswith(qp.path):
195+
try:
196+
qp.send_messages()
197+
except Exception:
198+
log.exception(
199+
'Encountered fatal exception when sending messages'
200+
)
201+
return
202+
203+
# NOTE: In the vast majority of cases the trigger will be a file system
204+
# move since our DataManager creates a temporary file that then is
205+
# moved. But we should also trigger when new files are created just
206+
# in case this ever changes.
190207
def on_created(self, event: 'FileSystemEvent') -> None:
191208
src_path = os.path.abspath(event.src_path)
192209
for qp in self.queue_processors:

0 commit comments

Comments
 (0)