Stream ntfy notifications to app clients over /connect
Record every notification published to ntfy (run outbox, stage notify hooks, chat question/approval/reply) in a persisted app_notifications outbox and stream it to subscribe_notifications clients with an after cursor; clear_notifications and ack_attention clear across devices, as do runs leaving waiting, deleted runs and answered chat questions. Add the notify.ntfy_enabled setting (default on) to stop only the ntfy publish.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/pipeline"
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
@@ -123,6 +124,12 @@ func (r *runner) deleteRuns(ids []int64) (*protocol.RunsDeletedResult, error) {
|
||||
r.notifyMu.Lock()
|
||||
delete(r.notifyModes, id)
|
||||
r.notifyMu.Unlock()
|
||||
// A deleted run's notifications are gone on every device.
|
||||
if r.notes != nil {
|
||||
c, cancel := context.WithTimeout(r.ctx, 5*time.Second)
|
||||
r.notes.clearFor(c, pipeline.AppNotificationFilter{RunID: id})
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
if len(result.Deleted) > 0 {
|
||||
log.Printf("deleted runs %v (refused %d, freed %d bytes)", result.Deleted, len(result.Refused), result.FreedBytes)
|
||||
|
||||
Reference in New Issue
Block a user