FluxyChat

Reference

Quiet hours + batched notifications (P12-N)

Defer push and in-app alerts during a user-defined local quiet window. Notifications are queued and delivered as a consolidated batch when quiet hours end.

User settings

Configure in dashboard Notifications → Quiet hours:

FieldDefaultNotes
enabledoffMaster switch
timezoneUTCIANA timezone (e.g. Europe/Rome)
quietStart22:00Local time HH:MM
quietEnd07:00Supports overnight windows (22:00→07:00)
batchPushonQueue FCM + Web Push during quiet hours
batchInApponQueue in-app rows during quiet hours

Delivery flow

sequenceDiagram
  participant Msg as New message
  participant Worker
  participant Queue as notification_batch_queue
  participant Cron as */15 cron
  participant User

  Msg->>Worker: mention / DM / push
  Worker->>Worker: isInQuietHours?
  Worker->>Queue: enqueue (push / in_app)
  Cron->>Worker: flushDueNotificationBatches
  Worker->>User: consolidated push + batch in-app
  User->>Worker: GET /notifications
  Worker->>User: auto-flush if outside quiet hours

API

MethodPathPurpose
GET/notifications/quiet-hoursRead prefs + pendingBatch + inQuietHours
PATCH/notifications/quiet-hoursUpdate prefs (flushes if now outside window)
POST/notifications/flush-batchManual flush (409 if still in quiet hours)

Integration points

  • maybePushNotifyOnMessage — batches per-recipient push
  • createInAppNotification — batches mention/DM in-app rows
  • deliverUserDigest — defers digest web push during quiet hours
  • Cron */15 * * * *flushDueNotificationBatches
  • GET /notifications — auto-flush when user opens inbox outside quiet hours

Migration

Apply D1 migration 0059_quiet_hours.sql.

Environment

VariableDefault
QUIET_HOURS_ENABLEDenabled (false disables batching globally)

Wrangler

Cron trigger added: */15 * * * * for batch flush.

On this page