Redis: Force storage sync mode when reading pcaps, default to async mode

This commit is contained in:
Tim Wojtulewicz 2024-12-17 16:20:25 -07:00
parent 31e146b16d
commit 52d94b781a
2 changed files with 4 additions and 2 deletions

View file

@ -32,6 +32,6 @@ export {
# and the backend will be forced into synchronous mode, since # and the backend will be forced into synchronous mode, since
# time won't move forward the same as when capturing live # time won't move forward the same as when capturing live
# traffic. # traffic.
async_mode: bool &default=F; async_mode: bool &default=T;
}; };
} }

View file

@ -88,7 +88,9 @@ storage::BackendPtr Redis::Instantiate(std::string_view tag) { return make_intru
* with a corresponding message. * with a corresponding message.
*/ */
ErrorResult Redis::DoOpen(RecordValPtr options) { ErrorResult Redis::DoOpen(RecordValPtr options) {
async_mode = options->GetField<BoolVal>("async_mode")->Get(); // When reading traces we disable storage async mode globally (see src/storage/Backend.cc) since
// time moves forward based on the pcap and not based on real time.
async_mode = options->GetField<BoolVal>("async_mode")->Get() && ! zeek::run_state::reading_traces;
key_prefix = options->GetField<StringVal>("key_prefix")->ToStdString(); key_prefix = options->GetField<StringVal>("key_prefix")->ToStdString();
redisOptions opt = {0}; redisOptions opt = {0};