New function srv_archive_qitem().

This commit is contained in:
default 2023-12-17 15:21:16 +01:00
parent ad718e5b80
commit f8196b4ef6
3 changed files with 18 additions and 1 deletions

View file

@ -2135,10 +2135,12 @@ void process_queue_item(xs_dict *q_item)
unlink(tmpfn);
if (cnt == 0)
if (cnt == 0) {
srv_archive_qitem(q_item);
srv_debug(1, xs_fmt("no valid recipients for %s", tmpfn));
}
}
}
else
srv_log(xs_fmt("unexpected q_item type '%s'", type));
}

14
data.c
View file

@ -2752,3 +2752,17 @@ void srv_archive_error(const char *prefix, const xs_str *err,
fclose(f);
}
}
void srv_archive_qitem(xs_dict *q_item)
/* archives a q_item in the error folder */
{
xs *ntid = tid(0);
xs *fn = xs_fmt("%s/error/%s_qitem", srv_basedir, ntid);
FILE *f;
if ((f = fopen(fn, "w")) != NULL) {
xs_json_dump(q_item, 4, f);
fclose(f);
}
}

1
snac.h
View file

@ -64,6 +64,7 @@ void srv_archive(const char *direction, const char *url, xs_dict *req,
const char *body, int b_size);
void srv_archive_error(const char *prefix, const xs_str *err,
const xs_dict *req, const xs_val *data);
void srv_archive_qitem(xs_dict *q_item);
double mtime_nl(const char *fn, int *n_link);
#define mtime(fn) mtime_nl(fn, NULL)