Skip to content

Commit

Permalink
Reverted force_refresh to invalidate credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
dw-kihara committed May 21, 2024
1 parent 0aa24b0 commit 5947c04
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/aws_credentials.erl
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,12 @@ terminate(_Reason, _State) ->
handle_call(get_credentials, _From, State=#state{credentials=C}) ->
{reply, C, State};
handle_call({force_refresh, Options}, _From, State=#state{tref=T}) ->
Result = fetch_credentials(Options),
{ok, C, NewT} = fetch_credentials(Options),
case is_reference(T) of
true -> erlang:cancel_timer(T);
false -> ok
end,
case Result of
{ok, undefined, NewT} -> {reply, undefined, State#state{tref=NewT}};
{ok, C, NewT} -> {reply, C, State#state{credentials=C, tref=NewT}}
end;
{reply, C, State#state{credentials=C, tref=NewT}};
handle_call(Args, _From, State) ->
?LOG_WARNING("Unknown call: ~p~n", [Args], #{domain => [aws_credentials]}),
{noreply, State}.
Expand Down

0 comments on commit 5947c04

Please sign in to comment.