Don't fail silently if the job fifo is not ready.

This commit is contained in:
default 2023-02-11 06:28:36 +01:00
parent f325b567e3
commit 28d1da0a81
3 changed files with 9 additions and 1 deletions

2
data.c
View file

@ -1407,7 +1407,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
qmsg = xs_dict_append(qmsg, "seckey", 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 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); job_post(qmsg);
else { else {
qmsg = _enqueue_put(fn, qmsg); qmsg = _enqueue_put(fn, qmsg);

View file

@ -251,6 +251,13 @@ static sem_t job_sem;
xs_list *job_fifo = NULL; 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) void job_post(const xs_val *job)
/* posts a job for the threads to process it */ /* posts a job for the threads to process it */
{ {

1
snac.h
View file

@ -207,5 +207,6 @@ int snac_init(const char *_basedir);
int adduser(const char *uid); int adduser(const char *uid);
int resetpwd(snac *snac); int resetpwd(snac *snac);
int job_fifo_ready(void);
void job_post(const xs_val *job); void job_post(const xs_val *job);
void job_wait(xs_val **job); void job_wait(xs_val **job);