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

[SDESK-7444] - Planning: Migrate planning:flag_expired command to async #2149

Merged
merged 11 commits into from
Dec 13, 2024
17 changes: 10 additions & 7 deletions server/planning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
from superdesk import register_jinja_filter
from .common import get_formatted_address

from .commands import FlagExpiredItems, DeleteMarkedAssignments, ExportScheduledFilters, delete_spiked_items_handler
from .commands import (
flag_expired_items_handler,
DeleteMarkedAssignments,
ExportScheduledFilters,
delete_spiked_items_handler,
)
import planning.commands # noqa
import planning.feeding_services # noqa
import planning.feed_parsers # noqa
Expand Down Expand Up @@ -320,15 +325,13 @@ def init_scheduled_exports_task(app):


@celery.task(soft_time_limit=600)
def flag_expired():
FlagExpiredItems().run()
async def flag_expired():
await flag_expired_items_handler()


@celery.task(soft_time_limit=600)
def delete_spiked():
import asyncio

asyncio.run(delete_spiked_items_handler())
async def delete_spiked():
await delete_spiked_items_handler()


@celery.task(soft_time_limit=600)
Expand Down
2 changes: 1 addition & 1 deletion server/planning/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .flag_expired_items import FlagExpiredItems # noqa
from .flag_expired_items import flag_expired_items_handler # noqa
from .delete_spiked_items import delete_spiked_items_handler # noqa
from .delete_marked_assignments import DeleteMarkedAssignments # noqa
from .export_to_newsroom import ExportToNewsroom # noqa
Expand Down
Loading
Loading