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

11
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);
if (status == 205 && user && !xs_startswith(actor, srv_baseurl))
enqueue_actor_refresh(user, actor);
enqueue_actor_refresh(user, actor, 0);
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 */
{
xs *qmsg = _new_qmsg("actor_refresh", "", 0);
char *ntid = xs_dict_get(qmsg, "ntid");
xs *fn = xs_fmt("%s/queue/%s.json", user->basedir, ntid);
xs *qmsg = _new_qmsg("actor_refresh", "", 0);
xs *ntid = tid(forward_secs);
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 = _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_object_request(snac *user, const char *id, int forward_secs);
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);
int was_question_voted(snac *user, const char *id);