fix startup
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
e8747a5a30
commit
a6a1c96d44
|
@ -6,6 +6,7 @@ from timeit import default_timer
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
|
from django.db.utils import ProgrammingError
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from structlog.stdlib import get_logger
|
from structlog.stdlib import get_logger
|
||||||
from tenant_schemas_celery.task import TenantTask
|
from tenant_schemas_celery.task import TenantTask
|
||||||
|
@ -101,8 +102,13 @@ class TaskInfo:
|
||||||
duration = max(self.finish_timestamp - start, 0)
|
duration = max(self.finish_timestamp - start, 0)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
duration = 0
|
duration = 0
|
||||||
|
try:
|
||||||
|
tenant = get_current_tenant().tenant_uuid
|
||||||
|
# DB not yet initialized, let's not fail
|
||||||
|
except ProgrammingError:
|
||||||
|
tenant = ""
|
||||||
GAUGE_TASKS.labels(
|
GAUGE_TASKS.labels(
|
||||||
tenant=get_current_tenant().tenant_uuid,
|
tenant=tenant,
|
||||||
task_name=self.task_name.split(":")[0],
|
task_name=self.task_name.split(":")[0],
|
||||||
task_uid=self.result.uid or "",
|
task_uid=self.result.uid or "",
|
||||||
status=self.result.status.name.lower(),
|
status=self.result.status.name.lower(),
|
||||||
|
|
Reference in New Issue