hub (unreleased): review fix 1 — „told” is told at an address: a changed notification address is told again and waits again (the hole D84 exists for)
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
cbfeeb626e
commit
a6f4aa0b64
10 files changed
+412
-44
No files matched your search
@@ -116,15 +116,15 @@ func (h *Handler) endNotices(customerID string, start time.Time) {
|
||||
h.endNoticeStuck(customerID, n, now)
|
||||
continue
|
||||
}
|
||||
outcome, why := notify.EndNoticeFailed, "the hub has no mail service configured"
|
||||
outcome, why, addrKey := notify.EndNoticeFailed, "the hub has no mail service configured", ""
|
||||
if h.dispatcher != nil {
|
||||
// The day in the mail is the hub's own: its clock now + 30 days. Never the box's date.
|
||||
outcome, why = h.dispatcher.SendEndNotice(customerID, app, now.Add(offsitekeys.EndedAppAfter))
|
||||
outcome, why, addrKey = h.dispatcher.SendEndNotice(customerID, app, now.Add(offsitekeys.EndedAppAfter))
|
||||
}
|
||||
now = clock() // after the send returned
|
||||
switch outcome {
|
||||
case notify.EndNoticeSent:
|
||||
ok, merr := h.store.MarkEndNoticeTold(customerID, app, n.Press, store.EndNoticeHousehold, now)
|
||||
ok, merr := h.store.MarkEndNoticeTold(customerID, app, n.Press, store.EndNoticeHousehold, addrKey, now)
|
||||
if merr != nil || !ok {
|
||||
// The mail went and the record does not say so: the household is mailed again at a later report and
|
||||
// the 30 days start then. The safe direction (no deletion on a notice the hub cannot show).
|
||||
@@ -197,7 +197,7 @@ func (h *Handler) endNoticeToOperator(customerID string, n store.EndNotice, why
|
||||
if _, err := h.store.SaveEvent(customerID, offsitekeys.EventEndNoticeOperator, "warning", msg, string(details), "hub"); err != nil {
|
||||
h.logger.Printf("[WARN] [end-notice] %s event save FAILED for %s (the mail went): %v", offsitekeys.EventEndNoticeOperator, customerID, err)
|
||||
}
|
||||
ok, err := h.store.MarkEndNoticeTold(customerID, n.App, n.Press, store.EndNoticeOperator, toldAt)
|
||||
ok, err := h.store.MarkEndNoticeTold(customerID, n.App, n.Press, store.EndNoticeOperator, "", toldAt)
|
||||
if err != nil || !ok {
|
||||
return time.Time{}, fmt.Errorf("the operator's mail went, but the hub's record was not written (matched=%v, err=%v)", ok, err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user