Skip to content

Instantly share code, notes, and snippets.

@garbas
Created May 31, 2017 15:25
Show Gist options
  • Save garbas/fe03126cf92f1ad496c187c346ad2ee3 to your computer and use it in GitHub Desktop.
Save garbas/fe03126cf92f1ad496c187c346ad2ee3 to your computer and use it in GitHub Desktop.
asdas
- 2 services:
- notification_identity -> get notification channel for level by IDENTITY_ID
- notification_policy -> how often to notify IDENTITY_IDs
- move to mozilla-releng/services
- src/releng_notifcation_identity
- src/releng_notifcation_???
- request flow
1. signoff -> notification_policy
creates new notification_policy
current time: 12:00
POST /<uid>
{
"subject": "....",
"body": "....",
"deadline": 1234234564,
"policies": [
{ "identity": "group:firefox_release_owners_55"
, "urgency": "low",
, "start_timestamp": 0
, "stop_timestamp": 25
, "frequency": "*/15 * * * *"
},
{ "identity": "group:firefox_release_owners_55"
, "urgency": "normal",
, "start_timestamp": 25
, "stop_timestamp": 40
, "frequency": "*/10 * * * *"
},
{ "identity": "mozilla-ldap:[email protected]"
, "urgency": "high",
, "start_timestamp": 40
, "stop_timestamp": -1
, "frequency": "*/5 * * * *"
}
]
}
DELETE /<uid>
stop the notification_policy
2. every 5min we call notification trigger
GET /ticktack
for notification_policy in []:
for policy in notification_policy.policies:
if current > policy.stop_timestamp and current < policy.stop_timestamp :
continue
last_time_we_send_notification = get_from_db(...)
if last_time_we_send_notification not in policy.frequency:
continue
# low -> { "type": "email", "email": [....] }
# normal -> { "type": "irc", "channels": [....] }
# high -> { "type": "sms", "numbers": [....] }
notification_channel = get_from_notification_identity(
policy.identity,
policy.urgency,
)
send_notifications(notification_channel)
3. notification_policy
- per user
- mozilla-ldap:[email protected]
- per custom group
- group:firefox_release_owners_55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment