-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from uktrade/LTD-4630-background-task-cleanup
removed background task from lite-hmrc
- Loading branch information
Showing
21 changed files
with
21 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ coverage: | |
threshold: 0% | ||
if_ci_failed: error | ||
only_pulls: false | ||
ignore: | ||
- "mock_hmrc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,18 @@ | ||
from django.apps import AppConfig | ||
from django.conf import settings | ||
from django.db.models.signals import post_migrate | ||
|
||
|
||
class MailConfig(AppConfig): | ||
name = "mail" | ||
|
||
@classmethod | ||
def initialize_background_tasks(cls, **kwargs): | ||
from background_task.models import Task | ||
|
||
def initialize_send_licence_usage_figures_to_lite_api(cls, **kwargs): | ||
from mail.celery_tasks import send_licence_usage_figures_to_lite_api | ||
from mail.enums import ChiefSystemEnum | ||
from mail.models import UsageData | ||
from mail.tasks import LICENCE_DATA_TASK_QUEUE | ||
|
||
Task.objects.filter(queue=LICENCE_DATA_TASK_QUEUE).delete() | ||
if settings.BACKGROUND_TASK_ENABLED: | ||
# LITE/SPIRE Tasks | ||
if settings.CHIEF_SOURCE_SYSTEM == ChiefSystemEnum.SPIRE: | ||
usage_updates_not_sent_to_lite = UsageData.objects.filter(has_lite_data=True, lite_sent_at__isnull=True) | ||
for obj in usage_updates_not_sent_to_lite: | ||
send_licence_usage_figures_to_lite_api.delay(str(obj.id)) | ||
usage_updates_not_sent_to_lite = UsageData.objects.filter(has_lite_data=True, lite_sent_at__isnull=True) | ||
for obj in usage_updates_not_sent_to_lite: | ||
send_licence_usage_figures_to_lite_api.delay(str(obj.id)) | ||
|
||
def ready(self): | ||
post_migrate.connect(self.initialize_background_tasks, sender=self) | ||
post_migrate.connect(self.initialize_send_licence_usage_figures_to_lite_api, sender=self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters