More logging tweaks.

This commit is contained in:
default 2023-12-11 10:41:41 +01:00
parent c06b74cc8e
commit bfdaf380ea
2 changed files with 12 additions and 8 deletions

View File

@ -118,7 +118,7 @@ int activitypub_request(snac *user, const char *url, xs_dict **data)
int actor_request(const char *actor, xs_dict **data) int actor_request(const char *actor, xs_dict **data)
/* request an actor */ /* request an actor */
{ {
int status, status2; int status;
xs *payload = NULL; xs *payload = NULL;
if (data) if (data)
@ -129,9 +129,9 @@ int actor_request(const char *actor, xs_dict **data)
if (status != 200) { if (status != 200) {
/* actor data non-existent or stale: get from the net */ /* actor data non-existent or stale: get from the net */
status2 = activitypub_request(NULL, actor, &payload); status = activitypub_request(NULL, actor, &payload);
if (valid_status(status2)) { if (valid_status(status)) {
/* renew data */ /* renew data */
status = actor_add(actor, payload); status = actor_add(actor, payload);
@ -141,7 +141,7 @@ int actor_request(const char *actor, xs_dict **data)
} }
} }
else else
srv_debug(0, xs_fmt("actor_request error %d", status2)); srv_debug(0, xs_fmt("actor_request error %s %d", actor, status));
} }
/* collect the (presumed) shared inbox in this actor */ /* collect the (presumed) shared inbox in this actor */

12
data.c
View File

@ -649,10 +649,14 @@ int _object_add(const char *id, const xs_dict *obj, int ow)
xs *fn = _object_fn(id); xs *fn = _object_fn(id);
FILE *f; FILE *f;
if (!ow && mtime(fn) > 0.0) { if (mtime(fn) > 0.0) {
/* object already here */ if (!ow) {
srv_debug(1, xs_fmt("object_add object already here %s", id)); /* object already here */
return 204; /* No content */ srv_debug(1, xs_fmt("object_add object already here %s", id));
return 204; /* No content */
}
else
status = 200;
} }
if ((f = fopen(fn, "w")) != NULL) { if ((f = fopen(fn, "w")) != NULL) {