aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Ziener <mziener@lavabit.com>2010-10-14 14:34:18 +0200
committerMarco Ziener <mziener@lavabit.com>2010-10-14 14:34:18 +0200
commit9a20d171233eca0dee4a2c854cd15a878312ba65 (patch)
treecb245366021677d9911cc35a876a2b17d09b5d0a
parent5adc62e88518a1e0fe2784917546af8eb4706063 (diff)
downloaderlang-9a20d171233eca0dee4a2c854cd15a878312ba65.tar.gz
erlang-9a20d171233eca0dee4a2c854cd15a878312ba65.tar.xz
erlang-9a20d171233eca0dee4a2c854cd15a878312ba65.zip
Errors fixed
-rw-r--r--server/media.erl13
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.
+