mirror of
https://github.com/bugsink/bugsink.git
synced 2026-01-01 10:50:47 -06:00
As discussed in #11, there are scenarios (e.g. misconfiguration) where snappea does not pick up the tasks. Events not showing up in Bugsink, w/o further indication why that may be, leaves people confused. Better to warn explicitly in that case.
28 lines
724 B
Python
28 lines
724 B
Python
import os
|
|
|
|
from django.db import models
|
|
|
|
from .settings import get_settings
|
|
from . import thread_uuid
|
|
|
|
|
|
class Task(models.Model):
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
task_name = models.CharField(max_length=255)
|
|
args = models.TextField(null=False, default='[]')
|
|
kwargs = models.TextField(null=False, default='{}')
|
|
|
|
def __str__(self):
|
|
return self.task_name
|
|
|
|
|
|
def wakeup_server():
|
|
wakeup_file = os.path.join(get_settings().WAKEUP_CALLS_DIR, thread_uuid)
|
|
|
|
if not os.path.exists(get_settings().WAKEUP_CALLS_DIR):
|
|
os.makedirs(get_settings().WAKEUP_CALLS_DIR, exist_ok=True)
|
|
|
|
if not os.path.exists(wakeup_file):
|
|
with open(wakeup_file, "w"):
|
|
pass
|