mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-09 00:13:31 +00:00
reader_concurrency_semaphore: inactive_read: make ttl_timer non-optional
By default it will be unarmed and with no callback so there's no need to wrap it in a std::optional. This saves an allocation and another potential error case. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -390,10 +390,10 @@ reader_concurrency_semaphore::inactive_read_handle reader_concurrency_semaphore:
|
||||
auto& ir = *irp;
|
||||
ir.notify_handler = std::move(notify_handler);
|
||||
if (ttl != std::chrono::duration_values<std::chrono::seconds>::max()) {
|
||||
ir.ttl_timer.emplace([this, &ir] {
|
||||
ir.ttl_timer.set_callback([this, &ir] {
|
||||
evict(ir, evict_reason::time);
|
||||
});
|
||||
ir.ttl_timer->arm(lowres_clock::now() + ttl);
|
||||
ir.ttl_timer.arm(lowres_clock::now() + ttl);
|
||||
}
|
||||
_inactive_reads.push_back(ir);
|
||||
++_stats.inactive_reads;
|
||||
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
struct inactive_read : public bi::list_base_hook<bi::link_mode<bi::auto_unlink>> {
|
||||
flat_mutation_reader reader;
|
||||
eviction_notify_handler notify_handler;
|
||||
std::optional<timer<lowres_clock>> ttl_timer;
|
||||
timer<lowres_clock> ttl_timer;
|
||||
|
||||
explicit inactive_read(flat_mutation_reader reader_) noexcept
|
||||
: reader(std::move(reader_))
|
||||
|
||||
Reference in New Issue
Block a user