@@ -88,7 +88,8 @@ code_change(_OldVsn, State, _Extra) ->
8888% %%===================================================================
8989% %% Internal functions
9090% %%===================================================================
91- schedule ({eval , Name , _Dir , Specs , _Fun } = Eval , _Result ,
91+ schedule ({eval , Name , _Dir , Specs , _Fun } = Eval ,
92+ {_ , _ , NumSegmentRemaining },
9293 # state {scheduled = Scheduled0 } = State ) ->
9394 % % we need to check the scheduled map even if the current specs do not
9495 % % include max_age as the retention config could have changed
@@ -99,9 +100,9 @@ schedule({eval, Name, _Dir, Specs, _Fun} = Eval, _Result,
99100 error ->
100101 Scheduled0
101102 end ,
102- case lists :any (fun ({T , _ }) -> T == max_age end , Specs ) of
103+ case lists :any (fun ({T , _ }) -> T == max_age end , Specs ) andalso
104+ NumSegmentRemaining > 1 of
103105 true ->
104- % % schedule a new eval
105106 EvalInterval = application :get_env (osiris , retention_eval_interval ,
106107 ? DEFAULT_SHEDULED_EVAL_TIME ),
107108 Ref = erlang :send_after (EvalInterval , self (), {'$gen_cast' , Eval }),
0 commit comments