Skip to content

Commit 2eda462

Browse files
committed
Wait between the pulls, restart on failure
1 parent 4c7cec4 commit 2eda462

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

.devcontainer/python/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
},
3939
"containerEnv": {
40-
"NATS_URL": "http://nats-server:4222"
40+
"NATS_URL": "nats://nats-server:4222"
4141
},
4242
"shutdownAction": "stopCompose"
4343
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ urls-secondary.txt
1212
prom-storage
1313
__debug_*
1414
.env
15+
*.pyc

compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ services:
6868
nats-indexer:
6969
deploy:
7070
replicas: 1
71+
restart: always
7172
image: ghcr.io/heussd/nats-news-analysis/nats-indexer:latest
7273
environment:
7374
- 'NATS_URL=nats-server:4222'

python/nats-indexer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ async def run():
4444
for msg in msgs:
4545
await msg.ack()
4646
except asyncio.TimeoutError:
47-
print("No new messages, waiting...")
47+
print("No new messages, waiting 10 secs...")
48+
await asyncio.sleep(10)
4849
continue
4950

5051

0 commit comments

Comments
 (0)