attempt to bump up counters if something has actually happened

This commit is contained in:
SJ 2015-07-28 21:57:51 +02:00
parent 39468c3877
commit b03bb23f81

View File

@ -55,6 +55,8 @@ void update_counters(struct session_data *sdata, struct __data *data, struct __c
char key[MAX_MEMCACHED_KEY_LEN]; char key[MAX_MEMCACHED_KEY_LEN];
unsigned int flags=0; unsigned int flags=0;
if(counters->c_virus + counters->c_duplicate + counters->c_ignore + counters->c_size + counters->c_stored_size <= 0) return;
if(cfg->update_counters_to_memcached == 1){ if(cfg->update_counters_to_memcached == 1){
/* increment counters to memcached */ /* increment counters to memcached */
@ -114,6 +116,8 @@ void update_counters(struct session_data *sdata, struct __data *data, struct __c
} }
else { else {
#endif #endif
if(counters->c_virus + counters->c_duplicate + counters->c_ignore + counters->c_size + counters->c_stored_size <= 0) return;
snprintf(buf, SMALLBUFSIZE-1, "UPDATE `%s` SET `rcvd`=`rcvd`+%llu, `virus`=`virus`+%llu, `duplicate`=`duplicate`+%llu, `ignore`=`ignore`+%llu, `size`=`size`+%llu, `stored_size`=`stored_size`+%llu", SQL_COUNTER_TABLE, counters->c_rcvd, counters->c_virus, counters->c_duplicate, counters->c_ignore, counters->c_size, counters->c_stored_size); snprintf(buf, SMALLBUFSIZE-1, "UPDATE `%s` SET `rcvd`=`rcvd`+%llu, `virus`=`virus`+%llu, `duplicate`=`duplicate`+%llu, `ignore`=`ignore`+%llu, `size`=`size`+%llu, `stored_size`=`stored_size`+%llu", SQL_COUNTER_TABLE, counters->c_rcvd, counters->c_virus, counters->c_duplicate, counters->c_ignore, counters->c_size, counters->c_stored_size);
p_query(sdata, buf, cfg); p_query(sdata, buf, cfg);