Resilience: retry logic, graceful shutdown, SO_REUSEADDR, LoadDaemon ThrottleInterval
- whatsappApi.js: exponential backoff (3 retries) voor 5xx en connectiefouten op sendTextMessage en sendImageMessage - index.js: SO_REUSEADDR port binding, EADDRINUSE retry, graceful shutdown (SIGTERM/SIGINT) - README.md: documentatie resilience maatregelen bijgewerkt - LoadDaemon plist: ThrottleInterval=10 tegen restart-loops
This commit is contained in:
parent
f46889956b
commit
2be27f70f1
1 changed files with 120 additions and 30 deletions
|
|
@ -1,5 +1,5 @@
|
|||
const { findDienst, getPngFilePaths } = require('./dienstService')
|
||||
const { sendTextMessage, sendImageMessage, notifyAdmin } = require('./whatsappApi')
|
||||
const { sendTextMessage, sendImageMessage, notifyAdmin, sendChatSeen } = require('./whatsappApi')
|
||||
const { checkLimit, increment, MAX_REQUESTS_PER_DAY } = require('./rateLimiter')
|
||||
const { increment: incrementDaily } = require('./dailyStats')
|
||||
const { checkAndRepinPinnedMessage } = require('./pinnedMessageService')
|
||||
|
|
@ -27,6 +27,10 @@ async function handleWebhook(payload) {
|
|||
|
||||
incrementDaily()
|
||||
|
||||
sendChatSeen(ALLOWED_GROUP).catch(err =>
|
||||
console.error('Failed to mark chat as seen:', err.message)
|
||||
)
|
||||
|
||||
console.log(`Processing dienst ${dienstnummer} for ${message.author}`)
|
||||
|
||||
const author = message.author
|
||||
|
|
|
|||
Loading…
Reference in a new issue