Permalink
Browse files

Merge pull request #43 from cloudant/guard-against-empty-list

Guard against empty list
  • Loading branch information...
2 parents cfbb280 + beb54c9 commit d46915a6dfa996ec22608d91472923943d2d2ec6 @kocolosk kocolosk committed Mar 7, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/mem3.erl
View
2 src/mem3.erl
@@ -222,6 +222,8 @@ choose_ushards(DbName, Shards) ->
{_, Result} = lists:foldl(Fun, {0, []}, Groups),
Result.
+rotate_list(_DbName, []) ->
+ [];
rotate_list(DbName, List) ->
{H, T} = lists:split(erlang:crc32(DbName) rem length(List), List),
T ++ H.

0 comments on commit d46915a

Please sign in to comment.