DEV: In test, if flush is called and there is no thread, flush inline (#21426)

This commit is contained in:
Sam 2023-05-08 13:25:00 +10:00 committed by GitHub
parent 608bde734b
commit ac0673d29e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -83,10 +83,13 @@ module CachedCounting
end
def self.flush
if @thread
if @thread && @thread.alive?
@flush = true
@thread.wakeup
sleep 0.001 while @flush
else
flush_in_memory
flush_to_db
end
end