gpointer ptr;
struct rspamd_fuzzy_mirror *m;
guint nupdates = 0, i;
- time_t now = time (NULL);
if (ctx->updates_pending &&
g_queue_get_length (ctx->updates_pending) > 0 &&
}
if (cmd->cmd == FUZZY_WRITE) {
- rspamd_fuzzy_backend_add (ctx->backend, ptr, now);
+ rspamd_fuzzy_backend_add (ctx->backend, ptr);
}
else {
rspamd_fuzzy_backend_del (ctx->backend, ptr);
{
.idx = RSPAMD_FUZZY_BACKEND_INSERT,
.sql = "INSERT INTO digests(flag, digest, value, time) VALUES"
- "(?1, ?2, ?3, ?4);",
- .args = "SDII",
+ "(?1, ?2, ?3, strftime('%s','now'));",
+ .args = "SDI",
.stmt = NULL,
.result = SQLITE_DONE
},
{
.idx = RSPAMD_FUZZY_BACKEND_UPDATE,
- .sql = "UPDATE digests SET value = value + ?1 WHERE "
+ .sql = "UPDATE digests SET value = value + ?1, time = strftime('%s','now') WHERE "
"digest==?2;",
.args = "ID",
.stmt = NULL,
},
{
.idx = RSPAMD_FUZZY_BACKEND_UPDATE_FLAG,
- .sql = "UPDATE digests SET value = ?1, flag = ?2 WHERE "
+ .sql = "UPDATE digests SET value = ?1, flag = ?2, time = strftime('%s','now') WHERE "
"digest==?3;",
.args = "IID",
.stmt = NULL,
gboolean
rspamd_fuzzy_backend_add (struct rspamd_fuzzy_backend *backend,
- const struct rspamd_fuzzy_cmd *cmd,
- time_t timestamp)
+ const struct rspamd_fuzzy_cmd *cmd)
{
int rc, i;
gint64 id, flag;
RSPAMD_FUZZY_BACKEND_INSERT,
(gint) (1U << (cmd->flag - 1)),
cmd->digest,
- (gint64) cmd->value,
- (gint64) timestamp);
+ (gint64) cmd->value);
if (rc == SQLITE_OK) {
if (cmd->shingles_count > 0) {
* @param cmd
* @return
*/
-gboolean rspamd_fuzzy_backend_add (
- struct rspamd_fuzzy_backend *backend,
- const struct rspamd_fuzzy_cmd *cmd,
- time_t timestamp);
+gboolean rspamd_fuzzy_backend_add (struct rspamd_fuzzy_backend *backend,
+ const struct rspamd_fuzzy_cmd *cmd);
/**
* Delete digest from the database