Skip to content

Commit

Permalink
core: on rsc update expect error, flush resource cache (#3343)
Browse files Browse the repository at this point in the history
  • Loading branch information
mworrell committed Mar 21, 2023
1 parent 16dfdb2 commit 4093537
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/models/m_rsc_update.erl
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,11 @@ update_result({ok, NewId, OldProps, NewProps, OldCatList, IsCatInsert}, #rscupd{

% Return the updated or inserted id
{ok, NewId};
update_result({error, {expected, version, _}} = Error, #rscupd{ id = Id }, _Context) ->
update_result({error, {expected, _, _}} = Error, #rscupd{ id = Id }, Context) ->
% We might have an out-of-date cached value, flush caches to force
% an update from the database.
z_depcache:flush_process_dict(),
flush(Id, Context),
lager:error("Error updating resource ~p: ~p", [ Id, Error ]),
Error;
update_result({rollback, {_Why, _} = Er}, _RscUpd, _Context) ->
Expand Down

0 comments on commit 4093537

Please sign in to comment.