Skip to content

Commit

Permalink
Make processing of new_torrent_metadata_created notification synchr…
Browse files Browse the repository at this point in the history
…onous
  • Loading branch information
kozlovsky committed Feb 8, 2022
1 parent 107e026 commit 3565b57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def __init__(self, notifier: Notifier, db: TagDatabase, mds: MetadataStore,
self.mds = mds
self.batch_size = batch_size
self.interval = interval
self.notifier.add_observer(notifications.new_torrent_metadata_created, self.process_torrent_title)
self.notifier.add_observer(notifications.new_torrent_metadata_created, self.process_torrent_title,
synchronous=True)

@db_session
def start(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def test_constructor(tag_rules_processor: TagRulesProcessor):
assert tag_rules_processor.interval == TEST_INTERVAL

m: MagicMock = tag_rules_processor.notifier.add_observer
m.assert_called_with(notifications.new_torrent_metadata_created, tag_rules_processor.process_torrent_title)
m.assert_called_with(notifications.new_torrent_metadata_created, tag_rules_processor.process_torrent_title,
synchronous=True)


@patch.object(TagRulesProcessor, 'save_tags')
Expand Down

0 comments on commit 3565b57

Please sign in to comment.