Allways wait for kvstorage worker to prevent data corruption.
g_queue_push_head (db->ops_queue, op);
g_hash_table_insert (db->ops_hash, ELT_KEY (elt), op);
- if (g_queue_get_length (db->ops_queue) >= db->sync_ops) {
+ if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) {
return bdb_process_queue (backend);
}
g_queue_push_head (db->ops_queue, op);
g_hash_table_insert (db->ops_hash, ELT_KEY (elt), op);
- if (g_queue_get_length (db->ops_queue) >= db->sync_ops) {
+ if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) {
return bdb_process_queue (backend);
}
g_queue_push_head (db->ops_queue, op);
g_hash_table_insert (db->ops_hash, ELT_KEY(elt), op);
- if (g_queue_get_length (db->ops_queue) >= db->sync_ops) {
+ if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) {
bdb_process_queue (backend);
}
}
}
+ msg_info ("syncing storages");
destroy_kvstorage_config ();
close_log (rspamd_main->logger);
exit (EXIT_SUCCESS);
g_queue_push_head (db->ops_queue, op);
g_hash_table_insert (db->ops_hash, ELT_KEY (elt), op);
- if (g_queue_get_length (db->ops_queue) >= db->sync_ops) {
+ if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) {
return sqlite_process_queue (backend);
}
g_queue_push_head (db->ops_queue, op);
g_hash_table_insert (db->ops_hash, ELT_KEY (elt), op);
- if (g_queue_get_length (db->ops_queue) >= db->sync_ops) {
+ if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) {
return sqlite_process_queue (backend);
}
g_queue_push_head (db->ops_queue, op);
g_hash_table_insert (db->ops_hash, ELT_KEY(elt), op);
- if (g_queue_get_length (db->ops_queue) >= db->sync_ops) {
+ if (db->sync_ops > 0 && g_queue_get_length (db->ops_queue) >= db->sync_ops) {
sqlite_process_queue (backend);
}
if (waitpid (w->pid, &res, 0) == -1) {
if (errno == EINTR) {
- msg_info ("terminate worker %P with SIGKILL", w->pid);
- kill (w->pid, SIGKILL);
got_alarm = 1;
+ if (w->type != TYPE_KVSTORAGE) {
+ msg_info ("terminate worker %P with SIGKILL", w->pid);
+ kill (w->pid, SIGKILL);
+ }
+ else {
+ msg_info ("waiting for storages to sync");
+ wait_for_workers (key, value, unused);
+ return TRUE;
+ }
}
}