Skip to content

Commit

Permalink
removed some redundent code
Browse files Browse the repository at this point in the history
  • Loading branch information
zkessin committed Jan 26, 2014
1 parent bf44f6e commit 32f9602
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/boss_db.erl
Expand Up @@ -275,7 +275,7 @@ incr(Key, Count, Timeout) ->
delete(Key) ->
delete(Key, ?DEFAULT_TIMEOUT).

delete(Key, Timeout) ->
delete(Key, Timeout) when is_integer(Timeout) ->
case boss_db:find(Key, Timeout) of
undefined ->
{error, not_found};
Expand All @@ -293,25 +293,9 @@ delete(Key, Timeout) ->
{error, Reason} ->
{error, Reason}
end
end;

delete(AboutToDelete,_)
when is_tuple(AboutToDelete), is_list(element(2, AboutToDelete)) ->
Key = element(2, AboutToDelete),
case boss_record_lib:run_before_delete_hooks(AboutToDelete) of
ok ->
Result = db_call({delete, Key}),
case Result of
ok ->
boss_news:deleted(Key, AboutToDelete:attributes()),
ok;
_ ->
Result
end;
{error, Reason} ->
{error, Reason}
end.


push() ->
db_call(push).

Expand Down

0 comments on commit 32f9602

Please sign in to comment.