diff options
| author | grunfink <grunfink@comam.es> | 2025-09-12 21:48:34 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2025-09-12 21:48:34 +0200 |
| commit | 08f99232e0854529bfd6f74d22d56fd4c8cc4cb5 (patch) | |
| tree | 9f3fd3815f4642e34a5b79d9d3f85215919122b4 /activitypub.c | |
| parent | 74e021cbb7c204c8141825a9e82065c45dba26e1 (diff) | |
New function instance_failure().
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c index 5fb60ba..ce3be35 100644 --- a/activitypub.c +++ b/activitypub.c @@ -2261,6 +2261,9 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req) return -1; } + /* this instance is alive */ + instance_failure(actor, 2); + /* question votes may not have a type */ if (xs_is_null(type)) type = "Note"; @@ -3152,6 +3155,11 @@ void process_queue_item(xs_dict *q_item) return; } + if (instance_failure(inbox, 0)) { + srv_debug(1, xs_fmt("too many failures for instance %s", inbox)); + return; + } + /* deliver (if previous error status was a timeout, try now longer) */ if (p_status == 599) timeout = xs_number_get(xs_dict_get_def(srv_config, "queue_timeout_2", "8")); @@ -3163,6 +3171,9 @@ void process_queue_item(xs_dict *q_item) status = send_to_inbox_raw(keyid, seckey, inbox, msg, &payload, &p_size, timeout); + /* register or clear a value for this instance */ + instance_failure(inbox, valid_status(status) ? 2 : 1); + if (payload) { if (p_size > 64) { /* trim the message */ |