Skip to content

Commit 0466160

Browse files
committed
silence logs on recurring task configuration
1 parent 7e6fbfd commit 0466160

6 files changed

Lines changed: 25 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ future, on a regular basis like cron jobs. These are managed by the scheduler
441441
process and are defined using the `@recurring` decorator:
442442

443443
```python
444-
from steady_queue import recurring
444+
from steady_queue.recurring_task import recurring
445445

446446
@recurring(schedule="0 12 * * *", key="rot the brains at noon")
447447
@task()

TODOs.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
- [ ] Django checks
3838
- [ ] Retry on database is locked
3939
- [ ] Django admin permissions
40-
- [ ] Signals: pre/post enqueue, pre/post perform
40+
- [ ] Signals on tasks: pre/post enqueue, pre/post perform
4141
- [ ] Contributing
4242
- [ ] Readme
4343
- [ ] Support for multiple databases
4444
- [ ] Publish to PyPI
45+
- [ ] Automatically disable enqueue on commit for recurring tasks

steady_queue/recurring_task.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def recurring(
2222
2323
Usage:
2424
25-
@recurring_task(schedule="*/1 * * * *", key="unique_task_key")
25+
@recurring(schedule="*/1 * * * *", key="unique_task_key")
2626
@task()
2727
def my_recurring_task():
2828
print("This runs every minute")
@@ -48,10 +48,6 @@ def wrapper(task: SteadyQueueTask):
4848
description=description,
4949
)
5050
configurations.append(configuration)
51-
logger.info(
52-
"configured recurring task: %(configuration)s",
53-
{"configuration": configuration},
54-
)
5551

5652
return task
5753

tests/dummy/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from django.db import models
22

3+
from .tasks import dummy_task
4+
35

46
class Dummy(models.Model):
57
name = models.CharField(max_length=100)
8+
9+
def work(self):
10+
dummy_task.enqueue()

tests/dummy/urls.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from django.conf import settings
2+
from django.conf.urls.static import static
3+
from django.contrib import admin
4+
from django.urls import path
5+
6+
urlpatterns = [
7+
path("admin/", admin.site.urls),
8+
]
9+
10+
if settings.DEBUG: # pragma: no cover
11+
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

tests/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"django.contrib.contenttypes",
1919
"django.contrib.sessions",
2020
"django.contrib.messages",
21+
"django.contrib.staticfiles",
2122
"steady_queue",
2223
"tests.dummy",
2324
]
@@ -56,6 +57,10 @@
5657

5758
ALLOWED_HOSTS = ["*"]
5859

60+
ROOT_URLCONF = "tests.dummy.urls"
61+
62+
STATIC_URL = "/static/"
63+
5964
DEBUG = True
6065

6166
# Internationalization

0 commit comments

Comments
 (0)