summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c2
-rw-r--r--httpd.c7
-rw-r--r--snac.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/data.c b/data.c
index a500b03..43fbeef 100644
--- a/data.c
+++ b/data.c
@@ -1407,7 +1407,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
qmsg = xs_dict_append(qmsg, "seckey", seckey);
/* if it's to be sent right now, bypass the disk queue and post the job */
- if (retries == 0)
+ if (retries == 0 && job_fifo_ready())
job_post(qmsg);
else {
qmsg = _enqueue_put(fn, qmsg);
diff --git a/httpd.c b/httpd.c
index 1208e84..b952edc 100644
--- a/httpd.c
+++ b/httpd.c
@@ -251,6 +251,13 @@ static sem_t job_sem;
xs_list *job_fifo = NULL;
+int job_fifo_ready(void)
+/* returns true if the job fifo is ready */
+{
+ return job_fifo != NULL;
+}
+
+
void job_post(const xs_val *job)
/* posts a job for the threads to process it */
{
diff --git a/snac.h b/snac.h
index 5190f42..1be36cb 100644
--- a/snac.h
+++ b/snac.h
@@ -207,5 +207,6 @@ int snac_init(const char *_basedir);
int adduser(const char *uid);
int resetpwd(snac *snac);
+int job_fifo_ready(void);
void job_post(const xs_val *job);
void job_wait(xs_val **job);