Skip to content

Commit

Permalink
Trap some exceptions occuring during the recording of the number of d…
Browse files Browse the repository at this point in the history
…ownloads.
  • Loading branch information
Ummon committed Jul 18, 2013
1 parent feefec5 commit 982d9e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions modules/erl/d_lan_db.erl
Expand Up @@ -104,14 +104,18 @@ loop() ->
receive
{new_download, Filename} ->
Date = now_utc(),
case dets:lookup(?DB_DOWNLOADS_COUNT, {Filename, Date}) of
[] ->
dets:insert(?DB_DOWNLOADS_COUNT, [{{Filename, Date}, 1}]),
loop();
[{_, N}] ->
dets:insert(?DB_DOWNLOADS_COUNT, [{{Filename, Date}, N + 1}]),
loop()
end;
try
case dets:lookup(?DB_DOWNLOADS_COUNT, {Filename, Date}) of
[] ->
dets:insert(?DB_DOWNLOADS_COUNT, [{{Filename, Date}, 1}]);
[{_, N}] ->
dets:insert(?DB_DOWNLOADS_COUNT, [{{Filename, Date}, N + 1}])
end
catch
Exception ->
io:format("An exception has occured when inserting a download count: ~p~n", [Exception])
end,
loop();
stop ->
ok
end.
Expand Down
2 changes: 1 addition & 1 deletion tools/deploy.sh
Expand Up @@ -23,7 +23,7 @@ cd ..
mkdir $TARGET/db # Yaws should have the permission to write in this folder.

rsync $RSYNC_OPTS colorbox $TARGET
rsync $RSYNC_OPTS files $TARGET --exclude '*.*'
rsync $RSYNC_OPTS files $TARGET --include '*.svg' --exclude '*.*'
rsync $RSYNC_OPTS img $TARGET
rsync $RSYNC_OPTS modules/ebin $TARGET/modules/
rsync $RSYNC_OPTS modules/include $TARGET/modules/
Expand Down

0 comments on commit 982d9e2

Please sign in to comment.