diff options
| author | 2025-09-07 08:30:18 +0200 | |
|---|---|---|
| committer | 2025-09-07 08:30:18 +0200 | |
| commit | 7796bf39f0f1fe5bea4cde5a426bee872602ca84 (patch) | |
| tree | fa3377bb3b5fd6e789c711d46b657c2ebe68753b | |
| parent | Changed fsck debug level. (diff) | |
| download | snac2-7796bf39f0f1fe5bea4cde5a426bee872602ca84.tar.gz snac2-7796bf39f0f1fe5bea4cde5a426bee872602ca84.tar.xz snac2-7796bf39f0f1fe5bea4cde5a426bee872602ca84.zip | |
Always do a deferred fsck at startup.
| -rw-r--r-- | activitypub.c | 6 | ||||
| -rw-r--r-- | data.c | 11 | ||||
| -rw-r--r-- | httpd.c | 2 | ||||
| -rw-r--r-- | snac.h | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c index d699fee..5fb60ba 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -3377,6 +3377,12 @@ void process_queue_item(xs_dict *q_item) | |||
| 3377 | rss_poll_hashtags(); | 3377 | rss_poll_hashtags(); |
| 3378 | } | 3378 | } |
| 3379 | else | 3379 | else |
| 3380 | if (strcmp(type, "fsck") == 0) { | ||
| 3381 | srv_log(xs_fmt("started deferred data integrity check")); | ||
| 3382 | data_fsck(); | ||
| 3383 | srv_log(xs_fmt("finished deferred data integrity check")); | ||
| 3384 | } | ||
| 3385 | else | ||
| 3380 | srv_log(xs_fmt("unexpected q_item type '%s'", type)); | 3386 | srv_log(xs_fmt("unexpected q_item type '%s'", type)); |
| 3381 | } | 3387 | } |
| 3382 | 3388 | ||
| @@ -3605,6 +3605,17 @@ void enqueue_collect_outbox(snac *user, const char *actor_id) | |||
| 3605 | } | 3605 | } |
| 3606 | 3606 | ||
| 3607 | 3607 | ||
| 3608 | void enqueue_fsck(void) | ||
| 3609 | /* enqueues an fsck */ | ||
| 3610 | { | ||
| 3611 | xs *qmsg = _new_qmsg("fsck", "", 0); | ||
| 3612 | const char *ntid = xs_dict_get(qmsg, "ntid"); | ||
| 3613 | xs *fn = xs_fmt("%s/queue/%s.json", srv_basedir, ntid); | ||
| 3614 | |||
| 3615 | qmsg = _enqueue_put(fn, qmsg); | ||
| 3616 | } | ||
| 3617 | |||
| 3618 | |||
| 3608 | int was_question_voted(snac *user, const char *id) | 3619 | int was_question_voted(snac *user, const char *id) |
| 3609 | /* returns true if the user voted in this poll */ | 3620 | /* returns true if the user voted in this poll */ |
| 3610 | { | 3621 | { |
| @@ -805,6 +805,8 @@ static void *background_thread(void *arg) | |||
| 805 | 805 | ||
| 806 | srv_log(xs_fmt("background thread started")); | 806 | srv_log(xs_fmt("background thread started")); |
| 807 | 807 | ||
| 808 | enqueue_fsck(); | ||
| 809 | |||
| 808 | while (p_state->srv_running) { | 810 | while (p_state->srv_running) { |
| 809 | int cnt = 0; | 811 | int cnt = 0; |
| 810 | 812 | ||
| @@ -299,6 +299,7 @@ void enqueue_webmention(const xs_dict *msg); | |||
| 299 | void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries); | 299 | void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries); |
| 300 | void enqueue_collect_replies(snac *user, const char *post); | 300 | void enqueue_collect_replies(snac *user, const char *post); |
| 301 | void enqueue_collect_outbox(snac *user, const char *actor_id); | 301 | void enqueue_collect_outbox(snac *user, const char *actor_id); |
| 302 | void enqueue_fsck(void); | ||
| 302 | 303 | ||
| 303 | int was_question_voted(snac *user, const char *id); | 304 | int was_question_voted(snac *user, const char *id); |
| 304 | 305 | ||