Skip to content

Commit

Permalink
[sql_cacher] fix proper update on status/report upon quick exit
Browse files Browse the repository at this point in the history
Be sure the SR info is properly updated (on the reload result) even when doing a quick return upon no records loaded
  • Loading branch information
bogdan-iancu committed Jan 23, 2024
1 parent 3bef4af commit 32539ef
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions modules/sql_cacher/sql_cacher.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,11 +942,8 @@ static int load_entire_table(cache_entry_t *c_entry, db_handlers_t *db_hdls,
}

/* anything loaded ? if not, we can do a quick exit here */
if (RES_ROW_N(sql_res) == 0) {
lock_stop_write(db_hdls->c_entry->ref_lock);
db_hdls->db_funcs.free_result(db_hdls->db_con, sql_res);
return 0;
}
if (RES_ROW_N(sql_res) == 0)
goto done;

row = RES_ROWS(sql_res);
values = ROW_VALUES(row);
Expand Down Expand Up @@ -982,6 +979,7 @@ static int load_entire_table(cache_entry_t *c_entry, db_handlers_t *db_hdls,
}
} while (RES_ROW_N(sql_res) > 0);

done:
lock_stop_write(db_hdls->c_entry->ref_lock);

db_hdls->db_funcs.free_result(db_hdls->db_con, sql_res);
Expand Down

0 comments on commit 32539ef

Please sign in to comment.