diff options
author | Marco Ziener <mziener@lavabit.com> | 2010-10-14 14:34:18 +0200 |
---|---|---|
committer | Marco Ziener <mziener@lavabit.com> | 2010-10-14 14:34:18 +0200 |
commit | 9a20d171233eca0dee4a2c854cd15a878312ba65 (patch) | |
tree | cb245366021677d9911cc35a876a2b17d09b5d0a /server | |
parent | 5adc62e88518a1e0fe2784917546af8eb4706063 (diff) | |
download | erlang-9a20d171233eca0dee4a2c854cd15a878312ba65.tar.gz erlang-9a20d171233eca0dee4a2c854cd15a878312ba65.tar.xz erlang-9a20d171233eca0dee4a2c854cd15a878312ba65.zip |
Errors fixed
Diffstat (limited to 'server')
-rw-r--r-- | server/media.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/server/media.erl b/server/media.erl index 9d5bcb6..7e84b28 100644 --- a/server/media.erl +++ b/server/media.erl @@ -122,9 +122,9 @@ devote(Artist, Title) -> lock(Artist, Title) -> F = fun() -> [Head|_] = ask(Artist, Title), - Votes = Head#track.votes -1, - New = Head#track(votes = Votes), - mnesia:write(New), + Votes = Head#track.votes - 1, + New = Head#track{votes = Votes}, + mnesia:write(New) end, mnesia:transaction(F). @@ -133,13 +133,16 @@ unlock(Artist, Title) -> [Head|_] = ask(Artist, Title), Votes = Head#track.votes -1, New = Head#track{votes = Votes}, - mnesia:write(New), + mnesia:write(New) end, mnesia:transaction(F). lock_prozess(Artist, Title) -> lock(Artist, Title), receive - after TIMEOUT unlock(Artist, Title). + + after ?TIMEOUT -> + unlock(Artist, Title) end. + |