On Sun, 2007-09-30 at 13:56 +0300, Timo Sirainen wrote:
You already mentioned something about using FIFOs. I'm not exactly sure how the dspam calling works, but I think FIFOs would be the best way to do this and also in mailbox format-independent way.
The FIFO he wanted was pushing just the signatures to the external process w/o checking any validity or such.
If you do the spam training before COPY command finishes (i.e. in transaction_commit()), if something crashes in the middle you don't lose anything, because the entire COPY operation fails, and user tries it again later.
That's what I currently do.
I have a few quick questions.
The copy code has this:
keywords_list = mail_get_keywords(mail);
keywords = strarray_length(keywords_list) == 0 ? NULL :
mailbox_keywords_create(t, keywords_list);
if (mailbox_copy(t, mail, mail_get_flags(mail),
keywords, NULL) < 0)
ret = mail->expunged ? 0 : -1;
mailbox_keywords_free(t, &keywords);
I take it all the keywords handling is part of the mail and hence part of the transaction?
Also, you have src_trans = mailbox_transaction_begin(client->mailbox, 0);
is there no need to roll back that transaction if something fails? You don't seem to do so when e.g. mailbox_search_deinit fails but that still makes the COPY command return an error.
johannes