Skip to content

Commit fca88f6

Browse files
committed
Make interval between processing installs configurable
1 parent d64c7e4 commit fca88f6

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
- 'CELERY_BROKER=pyamqp://guest@rabbitmq//'
1313
- 'DEBUG=true'
1414
- 'GITHUB_APP_ID=9231'
15+
- 'PROCESS_INSTALLS_INTERVAL=30'
1516
depends_on:
1617
- rabbitmq
1718

gitconsensusservice/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
app.config.update(yaml.load(infile.read()))
1313

1414

15-
SETTINGS = ['DEBUG', 'GITHUB_PRIVATE_KEY', 'GITHUB_APP_ID', 'GITHUB_WEBHOOK_SECRET', 'CELERY_BROKER']
15+
SETTINGS = [
16+
'DEBUG',
17+
'GITHUB_PRIVATE_KEY',
18+
'GITHUB_APP_ID',
19+
'GITHUB_WEBHOOK_SECRET',
20+
'CELERY_BROKER',
21+
'PROCESS_INSTALLS_INTERVAL']
1622
for setting in SETTINGS:
1723
if setting in os.environ:
1824
app.config[setting] = os.environ[setting]

gitconsensusservice/worker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from celery.schedules import crontab
22
from gitconsensusservice.jobs import consensus
3-
from gitconsensusservice import celery
3+
from gitconsensusservice import celery, app
44

55

66
@celery.on_after_finalize.connect
77
def setup_periodic_tasks(sender, **kwargs):
88
sender.add_periodic_task(
9-
5 * 60.0,
9+
float(app.config.get('PROCESS_INSTALLS_INTERVAL', 5 * 60.0)),
1010
consensus.process_installs.s(),
1111
name='Root Task - Schedule Installation Jobs')

0 commit comments

Comments
 (0)