Refactored automatic mail deletion (#4569)
Added a configuration that allows you to delete mails without attachment instantly after the given interval. Introduced a define for the iteration size of how many mails will be deleted in each circle. It his highly recommended to not increase it too high or your char server might lag, if you have a lot of mails on your server. Always delete all mails sent by the server after the given interval in a single statement and ignoring the iteration size. Added transaction safety for mail deletion. With this a mail and it's attachments will always be safely deleted together. Fixed a duplication issue, when deletion of the mail would have failed, but the mail was still returned. Fixed notification of online characters in certain rate circumstances.
This commit is contained in:
@@ -3070,6 +3070,8 @@ bool char_config_read(const char* cfgName, bool normal){
|
||||
charserv_config.mail_return_days = atoi(w2);
|
||||
} else if (strcmpi(w1, "mail_delete_days") == 0) {
|
||||
charserv_config.mail_delete_days = atoi(w2);
|
||||
} else if (strcmpi(w1, "mail_return_empty") == 0) {
|
||||
charserv_config.mail_return_empty = config_switch(w2);
|
||||
} else if (strcmpi(w1, "allowed_job_flag") == 0) {
|
||||
charserv_config.allowed_job_flag = atoi(w2);
|
||||
} else if (strcmpi(w1, "import") == 0) {
|
||||
@@ -3245,11 +3247,11 @@ int do_init(int argc, char **argv)
|
||||
|
||||
// periodically check if mails need to be returned to their sender
|
||||
add_timer_func_list(mail_return_timer, "mail_return_timer");
|
||||
add_timer_interval(gettick() + 1000, mail_return_timer, 0, 0, 5 * 60 * 1000); // every 5 minutes
|
||||
add_timer_interval(gettick() + 1000, mail_return_timer, 0, 0, 1 * 60 * 1000); // every minute
|
||||
|
||||
// periodically check if mails need to be deleted completely
|
||||
add_timer_func_list(mail_delete_timer, "mail_delete_timer");
|
||||
add_timer_interval(gettick() + 1000, mail_delete_timer, 0, 0, 5 * 60 * 1000); // every 5 minutes
|
||||
add_timer_interval(gettick() + 1000, mail_delete_timer, 0, 0, 1 * 60 * 1000); // every minute
|
||||
|
||||
//check db tables
|
||||
if(charserv_config.char_check_db && char_checkdb() == 0){
|
||||
|
||||
Reference in New Issue
Block a user