Skip to content

Commit

Permalink
Ensure that data is also written to the DB when DB garbage collection…
Browse files Browse the repository at this point in the history
… is done (but before). This ensures that the queries will be written to the database even if the user specifies DBINTERVAL=n*60 (where n=1,2,3,...) which is a special that was not explicitly considered so far.

Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Dec 13, 2017
1 parent effca04 commit 5951e5b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions database.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,18 +445,17 @@ void *DB_thread(void *val)
// Set thread name
prctl(PR_SET_NAME,"DB",0,0,0);

if(!DBdeleteoldqueries)
{
// Lock FTL's data structure, since it is likely that it will be changed here
enable_thread_lock("DB_thread");
// Lock FTL's data structure, since it is likely that it will be changed here
enable_thread_lock("DB_thread");

// Save data to database
save_to_DB();
// Save data to database
save_to_DB();

// Release thread lock
disable_thread_lock("DB_thread");
}
else
// Release thread lock
disable_thread_lock("DB_thread");

// Check if GC should be done on the database
if(DBdeleteoldqueries)
{
// No thread locks needed
delete_old_queries_in_DB();
Expand Down

0 comments on commit 5951e5b

Please sign in to comment.