feat(buffer_worker): use offload mode for `replayq`

To avoid confusion for the users as to what persistence guarantees we
offer when buffering bridges/resources, we will always enable offload
mode for `replayq`.  With this, when the buffer size is above the max
segment size, it'll flush the queue to disk, but on recovery after a
restart it'll clean the existing segments rather than resuming from
them.
This commit is contained in:
Thales Macedo Garitezi 2022-12-27 11:23:13 -03:00
parent 0fd8880d0a
commit bf3983e7c4
1 changed files with 6 additions and 3 deletions

View File

@ -139,10 +139,13 @@ init({Id, Index, Opts}) ->
true ->
replayq:open(#{
dir => disk_queue_dir(Id, Index),
seg_bytes => SegBytes,
marshaller => fun ?MODULE:queue_item_marshaller/1,
max_total_bytes => TotalBytes,
sizer => fun ?MODULE:estimate_size/1,
marshaller => fun ?MODULE:queue_item_marshaller/1
%% we don't want to retain the queue after
%% resource restarts.
offload => true,
seg_bytes => SegBytes,
sizer => fun ?MODULE:estimate_size/1
});
false ->
undefined