Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proper sync task calling #744

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ def handle(self, *args, **options):
logger.info(
'index_enterprise_catalog_in_algolia_task launching synchronously.'
)
# For some reason in order to call a celery task in-memory you must pass kwargs as args.
index_enterprise_catalog_in_algolia_task(force_task_execution, dry_run)
index_enterprise_catalog_in_algolia_task.apply(
kwargs={'force': force_task_execution, 'dry_run': dry_run}
)
else:
index_enterprise_catalog_in_algolia_task.apply_async(
kwargs={'force': force_task_execution, 'dry_run': dry_run}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_reindex_algolia_no_async(self, mock_command_config, mock_task):
'no_async': True,
}
call_command(self.command_name)
mock_task.assert_called_once_with(False, False) # force=False, dry_run=False
mock_task.apply.assert_called_once_with(kwargs={'force': False, 'dry_run': False}) # force=False, dry_run=False
mock_task.apply_async.assert_not_called()

@mock.patch(PATH_PREFIX + 'index_enterprise_catalog_in_algolia_task')
Expand Down
Loading