In timeline_request(), call enqueue_actor_request on actor errors.

This commit is contained in:
default 2024-05-11 19:16:54 +02:00
parent 3954361785
commit 4d53a7b6f7
3 changed files with 22 additions and 17 deletions

View file

@ -356,14 +356,17 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
} }
if (xs_match(type, "Note|Page|Article|Video")) { if (xs_match(type, "Note|Page|Article|Video")) {
const char *actor = get_atto(object);
if (content_check("filter_reject.txt", object)) if (content_check("filter_reject.txt", object))
snac_log(snac, xs_fmt("timeline_request rejected by content %s", nid)); snac_log(snac, xs_fmt("timeline_request rejected by content %s", nid));
else { else {
const char *actor = get_atto(object);
if (!xs_is_null(actor)) {
/* request (and drop) the actor for this entry */ /* request (and drop) the actor for this entry */
if (!xs_is_null(actor)) if (!valid_status(actor_request(snac, actor, NULL))) {
actor_request(snac, actor, NULL); /* failed? retry later */
enqueue_actor_refresh(snac, actor, 60);
}
/* does it have an ancestor? */ /* does it have an ancestor? */
char *in_reply_to = xs_dict_get(object, "inReplyTo"); char *in_reply_to = xs_dict_get(object, "inReplyTo");
@ -377,6 +380,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
} }
} }
} }
}
enqueue_request_replies(snac, *id); enqueue_request_replies(snac, *id);
} }

7
data.c
View file

@ -1632,7 +1632,7 @@ int actor_get_refresh(snac *user, const char *actor, xs_dict **data)
int status = actor_get(actor, data); int status = actor_get(actor, data);
if (status == 205 && user && !xs_startswith(actor, srv_baseurl)) if (status == 205 && user && !xs_startswith(actor, srv_baseurl))
enqueue_actor_refresh(user, actor); enqueue_actor_refresh(user, actor, 0);
return status; return status;
} }
@ -2830,13 +2830,14 @@ void enqueue_verify_links(snac *user)
} }
void enqueue_actor_refresh(snac *user, const char *actor) void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs)
/* enqueues an actor refresh */ /* enqueues an actor refresh */
{ {
xs *qmsg = _new_qmsg("actor_refresh", "", 0); xs *qmsg = _new_qmsg("actor_refresh", "", 0);
char *ntid = xs_dict_get(qmsg, "ntid"); xs *ntid = tid(forward_secs);
xs *fn = xs_fmt("%s/queue/%s.json", user->basedir, ntid); xs *fn = xs_fmt("%s/queue/%s.json", user->basedir, ntid);
qmsg = xs_dict_set(qmsg, "ntid", ntid);
qmsg = xs_dict_append(qmsg, "actor", actor); qmsg = xs_dict_append(qmsg, "actor", actor);
qmsg = _enqueue_put(fn, qmsg); qmsg = _enqueue_put(fn, qmsg);

2
snac.h
View file

@ -232,7 +232,7 @@ void enqueue_message(snac *snac, const xs_dict *msg);
void enqueue_close_question(snac *user, const char *id, int end_secs); void enqueue_close_question(snac *user, const char *id, int end_secs);
void enqueue_object_request(snac *user, const char *id, int forward_secs); void enqueue_object_request(snac *user, const char *id, int forward_secs);
void enqueue_verify_links(snac *user); void enqueue_verify_links(snac *user);
void enqueue_actor_refresh(snac *user, const char *actor); void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs);
void enqueue_request_replies(snac *user, const char *id); void enqueue_request_replies(snac *user, const char *id);
int was_question_voted(snac *user, const char *id); int was_question_voted(snac *user, const char *id);