commit cd0e211

default  ·  2024-03-12 17:04:09 +0000 UTC
parent f485dbd
Don't call enqueue_actor_request() with a NULL user.
3 files changed,  +15, -1
M data.c
M snac.h
+2, -0
1@@ -2256,6 +2256,8 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
2 
3             if (valid_status((status = activitypub_request(snac, actor, &actor_o))))
4                 actor_add(actor, actor_o);
5+            else
6+                object_touch(actor);
7 
8             snac_log(snac, xs_fmt("refresh actor %s %d", actor, status));
9         }
M data.c
+11, -1
 1@@ -811,6 +811,16 @@ double object_mtime(const char *id)
 2 }
 3 
 4 
 5+void object_touch(const char *id)
 6+{
 7+    xs *md5 = xs_md5_hex(id, strlen(id));
 8+    xs *fn = _object_fn_by_md5(md5, "object_touch");
 9+
10+    if (mtime(fn))
11+        utimes(fn, NULL);
12+}
13+
14+
15 xs_str *_object_index_fn(const char *id, const char *idxsfx)
16 /* returns the filename of an object's index */
17 {
18@@ -1586,7 +1596,7 @@ int actor_get_refresh(snac *user, const char *actor, xs_dict **data)
19 {
20     int status = actor_get(actor, data);
21 
22-    if (status == 205)
23+    if (status == 205 && user && !xs_startswith(user->actor, srv_baseurl))
24         enqueue_actor_request(user, actor);
25 
26     return status;
M snac.h
+2, -0
1@@ -112,6 +112,8 @@ double object_ctime_by_md5(const char *md5);
2 double object_ctime(const char *id);
3 double object_mtime_by_md5(const char *md5);
4 double object_mtime(const char *id);
5+void object_touch(const char *id);
6+
7 int object_admire(const char *id, const char *actor, int like);
8 int object_unadmire(const char *id, const char *actor, int like);
9