commit 5d95ffa

grunfink  ·  2025-09-28 12:37:07 +0000 UTC
parent 335b90a
Revert "New function actor_failure()."

This reverts commit 335b90a9d1654aadb4e0d87114b82685defcd50b.
2 files changed,  +9, -19
M data.c
M snac.h
M data.c
+9, -18
 1@@ -3042,13 +3042,18 @@ xs_list *content_search(snac *user, const char *regex,
 2 }
 3 
 4 
 5-int actor_failure(const char *id, int op)
 6-/* actor failure maintenance */
 7+int instance_failure(const char *url, int op)
 8+/* do some checks and accounting on instance failures */
 9 {
10     int ret = 0;
11+    xs *l = xs_split(url, "/");
12+    const char *hostname = xs_list_get(l, 2);
13     double mt;
14 
15-    xs *md5 = xs_md5_hex(id, strlen(id));
16+    if (!xs_is_string(hostname))
17+        return 0;
18+
19+    xs *md5 = xs_md5_hex(hostname, strlen(hostname));
20     xs *fn = xs_fmt("%s/failure/%s", srv_basedir, md5);
21 
22     switch (op) {
23@@ -3070,7 +3075,7 @@ int actor_failure(const char *id, int op)
24 
25             /* only create once, as the date will be used */
26             if ((f = fopen(fn, "w")) != NULL) {
27-                fprintf(f, "%s\n", id);
28+                fprintf(f, "%s\n", hostname);
29                 fclose(f);
30             }
31         }
32@@ -3088,20 +3093,6 @@ int actor_failure(const char *id, int op)
33 }
34 
35 
36-int instance_failure(const char *url, int op)
37-/* instance failure maintenance */
38-{
39-    /* extract just the host name */
40-    xs *l = xs_split(url, "/");
41-    const char *hostname = xs_list_get(l, 2);
42-
43-    if (!xs_is_string(hostname))
44-        return 0;
45-
46-    return actor_failure(hostname, op);
47-}
48-
49-
50 /** notifications **/
51 
52 xs_str *notify_check_time(snac *snac, int reset)
M snac.h
+0, -1
1@@ -278,7 +278,6 @@ int content_match(const char *file, const xs_dict *msg);
2 xs_list *content_search(snac *user, const char *regex,
3             int priv, int skip, int show, int max_secs, int *timeout);
4 
5-int actor_failure(const char *id, int op);
6 int instance_failure(const char *url, int op);
7 
8 void enqueue_input(snac *snac, const xs_dict *msg, const xs_dict *req, int retries);