commit 4d53a7b

default  ·  2024-05-11 17:16:54 +0000 UTC
parent 3954361
In timeline_request(), call enqueue_actor_request on actor errors.
3 files changed,  +22, -17
M data.c
M snac.h
+15, -11
 1@@ -356,23 +356,27 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
 2                 }
 3 
 4                 if (xs_match(type, "Note|Page|Article|Video")) {
 5-                    const char *actor = get_atto(object);
 6-
 7                     if (content_check("filter_reject.txt", object))
 8                         snac_log(snac, xs_fmt("timeline_request rejected by content %s", nid));
 9                     else {
10-                        /* request (and drop) the actor for this entry */
11-                        if (!xs_is_null(actor))
12-                            actor_request(snac, actor, NULL);
13+                        const char *actor = get_atto(object);
14+
15+                        if (!xs_is_null(actor)) {
16+                            /* request (and drop) the actor for this entry */
17+                            if (!valid_status(actor_request(snac, actor, NULL))) {
18+                                /* failed? retry later */
19+                                enqueue_actor_refresh(snac, actor, 60);
20+                            }
21 
22-                        /* does it have an ancestor? */
23-                        char *in_reply_to = xs_dict_get(object, "inReplyTo");
24+                            /* does it have an ancestor? */
25+                            char *in_reply_to = xs_dict_get(object, "inReplyTo");
26 
27-                        /* store */
28-                        timeline_add(snac, nid, object);
29+                            /* store */
30+                            timeline_add(snac, nid, object);
31 
32-                        /* recurse! */
33-                        timeline_request(snac, &in_reply_to, NULL, level + 1);
34+                            /* recurse! */
35+                            timeline_request(snac, &in_reply_to, NULL, level + 1);
36+                        }
37                     }
38                 }
39             }
M data.c
+6, -5
 1@@ -1632,7 +1632,7 @@ int actor_get_refresh(snac *user, const char *actor, xs_dict **data)
 2     int status = actor_get(actor, data);
 3 
 4     if (status == 205 && user && !xs_startswith(actor, srv_baseurl))
 5-        enqueue_actor_refresh(user, actor);
 6+        enqueue_actor_refresh(user, actor, 0);
 7 
 8     return status;
 9 }
10@@ -2830,13 +2830,14 @@ void enqueue_verify_links(snac *user)
11 }
12 
13 
14-void enqueue_actor_refresh(snac *user, const char *actor)
15+void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs)
16 /* enqueues an actor refresh */
17 {
18-    xs *qmsg   = _new_qmsg("actor_refresh", "", 0);
19-    char *ntid = xs_dict_get(qmsg, "ntid");
20-    xs *fn     = xs_fmt("%s/queue/%s.json", user->basedir, ntid);
21+    xs *qmsg = _new_qmsg("actor_refresh", "", 0);
22+    xs *ntid = tid(forward_secs);
23+    xs *fn   = xs_fmt("%s/queue/%s.json", user->basedir, ntid);
24 
25+    qmsg = xs_dict_set(qmsg, "ntid", ntid);
26     qmsg = xs_dict_append(qmsg, "actor", actor);
27 
28     qmsg = _enqueue_put(fn, qmsg);
M snac.h
+1, -1
1@@ -232,7 +232,7 @@ void enqueue_message(snac *snac, const xs_dict *msg);
2 void enqueue_close_question(snac *user, const char *id, int end_secs);
3 void enqueue_object_request(snac *user, const char *id, int forward_secs);
4 void enqueue_verify_links(snac *user);
5-void enqueue_actor_refresh(snac *user, const char *actor);
6+void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs);
7 void enqueue_request_replies(snac *user, const char *id);
8 int was_question_voted(snac *user, const char *id);
9