aboutsummaryrefslogtreecommitdiff
path: root/cgi/servers.go
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2023-01-06 19:31:20 +0000
committerJulio Capote <jcapote@gmail.com>2023-01-06 19:31:20 +0000
commitea69d02af6e691a1b32e5198a1143aa142ba82ac (patch)
treee3f78254c84e02cda30402fa6a179547f5d38f97 /cgi/servers.go
parentfa52883f424c95dcde16e9056631041af4c479c7 (diff)
downloadcommunique-ea69d02af6e691a1b32e5198a1143aa142ba82ac.tar.gz
subscription lookup on outbox item create
Diffstat (limited to 'cgi/servers.go')
-rw-r--r--cgi/servers.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/cgi/servers.go b/cgi/servers.go
index 9d08b6c..a419417 100644
--- a/cgi/servers.go
+++ b/cgi/servers.go
@@ -116,7 +116,18 @@ func processTick(h config.Handler, output []byte, persister *models.Persister, l
log.Debugf("extracted content '%s'", extractedContent)
outboxItem := models.CreateOutboxItem(h, []byte(extractedContent))
err = persister.StoreWithCallback(outboxItem, func() {
- log.With("handler", h.Name).Debug("callback for save")
+ logger := log.With("handler", h.Name).With("type", "subscription")
+ // go through handler subscriptions and deliver signed outbox items
+ logger.Debug("callback for save")
+ sub := models.NewSubscription(h)
+ keys, err := persister.CollectKeys(sub)
+ if err != nil {
+ logger.Error(err)
+ return
+ }
+ for _, v := range keys {
+ logger.Debugf("found subscription %s", string(v))
+ }
})
if err != nil {
return err