Browse Source

htable: Fix de-/increment w/ auto expire

Update item expiration value during de-/incrementation for htables that
are configured with autoexpire and updateexpire disabled.
Otherwise an item cannot be used until timer cleaned it up.
Bastian Triller 8 months ago
parent
commit
b806232157
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/modules/htable/ht_api.c

+ 4 - 0
src/modules/htable/ht_api.c

@@ -743,6 +743,10 @@ ht_cell_t *ht_cell_value_add(ht_t *ht, str *name, int val, ht_cell_t *old)
 			if(now > 0 && it->expire != 0 && it->expire < now) {
 				/* entry has expired */
 
+				it->expire = ht->htexpire;
+				if(it->expire) {
+					it->expire += now;
+				}
 				if(ht->flags == PV_VAL_INT) {
 					/* initval is integer, use it to create a fresh entry */
 					it->flags &= ~AVP_VAL_STR;