Don't call enqueue_actor_request() with a NULL user.

This commit is contained in:
default 2024-03-12 18:04:09 +01:00
parent f485dbdaf0
commit cd0e211354
3 changed files with 15 additions and 1 deletions

View File

@ -2256,6 +2256,8 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
if (valid_status((status = activitypub_request(snac, actor, &actor_o))))
actor_add(actor, actor_o);
else
object_touch(actor);
snac_log(snac, xs_fmt("refresh actor %s %d", actor, status));
}

12
data.c
View File

@ -811,6 +811,16 @@ double object_mtime(const char *id)
}
void object_touch(const char *id)
{
xs *md5 = xs_md5_hex(id, strlen(id));
xs *fn = _object_fn_by_md5(md5, "object_touch");
if (mtime(fn))
utimes(fn, NULL);
}
xs_str *_object_index_fn(const char *id, const char *idxsfx)
/* returns the filename of an object's index */
{
@ -1586,7 +1596,7 @@ int actor_get_refresh(snac *user, const char *actor, xs_dict **data)
{
int status = actor_get(actor, data);
if (status == 205)
if (status == 205 && user && !xs_startswith(user->actor, srv_baseurl))
enqueue_actor_request(user, actor);
return status;

2
snac.h
View File

@ -112,6 +112,8 @@ double object_ctime_by_md5(const char *md5);
double object_ctime(const char *id);
double object_mtime_by_md5(const char *md5);
double object_mtime(const char *id);
void object_touch(const char *id);
int object_admire(const char *id, const char *actor, int like);
int object_unadmire(const char *id, const char *actor, int like);