@@ -1102,18 +1102,19 @@ handle_aux(_RaState, cast, eol, #?AUX{name = Name} = Aux, Log, _) ->
1102
1102
ets :delete (rabbit_fifo_usage , Name ),
1103
1103
{no_reply , Aux , Log };
1104
1104
handle_aux (_RaState , {call , _From }, oldest_entry_timestamp , Aux ,
1105
- Log , #? MODULE {} = State ) ->
1106
- Ts = case smallest_raft_index (State ) of
1107
- % % if there are no entries, we return current timestamp
1108
- % % so that any previously obtained entries are considered older than this
1109
- undefined ->
1110
- erlang :system_time (millisecond );
1111
- Idx when is_integer (Idx ) ->
1112
- % % TODO: make more defensive to avoid potential crash
1113
- {{_ , _ , {_ , Meta , _ , _ }}, _Log1 } = ra_log :fetch (Idx , Log ),
1114
- #{ts := Timestamp } = Meta ,
1115
- Timestamp
1116
- end ,
1105
+ Log0 , #? MODULE {} = State ) ->
1106
+ {Ts , Log } = case smallest_raft_index (State ) of
1107
+ % % if there are no entries, we return current timestamp
1108
+ % % so that any previously obtained entries are considered
1109
+ % % older than this
1110
+ undefined ->
1111
+ {erlang :system_time (millisecond ), Log0 };
1112
+ Idx when is_integer (Idx ) ->
1113
+ % % TODO: make more defensive to avoid potential crash
1114
+ {{_ , _ , {_ , Meta , _ , _ }}, Log1 } = ra_log :fetch (Idx , Log0 ),
1115
+ #{ts := Timestamp } = Meta ,
1116
+ {Timestamp , Log1 }
1117
+ end ,
1117
1118
{reply , {ok , Ts }, Aux , Log };
1118
1119
handle_aux (_RaState , {call , _From }, {peek , Pos }, Aux0 ,
1119
1120
Log0 , MacState ) ->
0 commit comments