-
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 #398 from hibare/dev
Dev merge
- Loading branch information
Showing
44 changed files
with
1,321 additions
and
991 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.11.3-slim as base | ||
FROM python:3.11.4-slim as base | ||
|
||
LABEL Github="hibare" | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Schedule jobs""" | ||
|
||
from django_apscheduler.models import DjangoJobExecution | ||
from django.conf import settings | ||
from jobs.models import Jobs | ||
from jobs.models import JobsHistory | ||
|
||
|
||
def delete_old_job_executions(max_age=604_800): | ||
"""This job deletes all apscheduler job executions older than `max_age` (in seconds) from the database.""" | ||
|
||
DjangoJobExecution.objects.delete_old_job_executions(max_age) | ||
|
||
|
||
def delete_old_job_history(): | ||
"""This job deletes all job history records older than `settings.JOB_HISTORY_PURGE_AGE` (in days) from the database.""" | ||
|
||
JobsHistory.objects.delete_old_history(settings.JOB_HISTORY_PURGE_AGE) | ||
|
||
|
||
def update_favicon_url() -> None: | ||
"""Update favicons of all registered jobs""" | ||
|
||
for job in Jobs.objects.all(): | ||
job.update_favicon_url() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.1 on 2023-06-08 14:22 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('notifiers', '0006_alter_notifiers_description'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='notifiers', | ||
name='state', | ||
field=models.BooleanField(default=True), | ||
), | ||
] |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""Schedule notifier jobs""" | ||
|
||
from django.conf import settings | ||
from notifiers.models import NotifiersHistory | ||
|
||
|
||
def delete_old_notifier_history(): | ||
"""This job delete all notifier history older than `settings.NOTIFIER_HISTORY_PURGE_AGE` (in days) from the database""" | ||
|
||
NotifiersHistory.objects.delete_old_history( | ||
settings.NOTIFIER_HISTORY_PURGE_AGE) |
Oops, something went wrong.