commit f8196b4

default  ·  2023-12-17 14:21:16 +0000 UTC
parent ad718e5
New function srv_archive_qitem().
3 files changed,  +18, -1
M data.c
M snac.h
+3, -1
 1@@ -2135,8 +2135,10 @@ void process_queue_item(xs_dict *q_item)
 2 
 3             unlink(tmpfn);
 4 
 5-            if (cnt == 0)
 6+            if (cnt == 0) {
 7+                srv_archive_qitem(q_item);
 8                 srv_debug(1, xs_fmt("no valid recipients for %s", tmpfn));
 9+            }
10         }
11     }
12     else
M data.c
+14, -0
 1@@ -2752,3 +2752,17 @@ void srv_archive_error(const char *prefix, const xs_str *err,
 2         fclose(f);
 3     }
 4 }
 5+
 6+
 7+void srv_archive_qitem(xs_dict *q_item)
 8+/* archives a q_item in the error folder */
 9+{
10+    xs *ntid = tid(0);
11+    xs *fn   = xs_fmt("%s/error/%s_qitem", srv_basedir, ntid);
12+    FILE *f;
13+
14+    if ((f = fopen(fn, "w")) != NULL) {
15+        xs_json_dump(q_item, 4, f);
16+        fclose(f);
17+    }
18+}
M snac.h
+1, -0
1@@ -64,6 +64,7 @@ void srv_archive(const char *direction, const char *url, xs_dict *req,
2                  const char *body, int b_size);
3 void srv_archive_error(const char *prefix, const xs_str *err,
4                        const xs_dict *req, const xs_val *data);
5+void srv_archive_qitem(xs_dict *q_item);
6 
7 double mtime_nl(const char *fn, int *n_link);
8 #define mtime(fn) mtime_nl(fn, NULL)