Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
redo
redo-2.0.0-git.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File redo-2.0.0-git.patch of Package redo
diff --git a/.gitignore b/.gitignore index befa2b8..cf950cc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ src/*.swp ebin .eunit .rebar +_build/ diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..5c2e5fe --- /dev/null +++ b/rebar.config @@ -0,0 +1,6 @@ +{erl_opts, []}. +{profiles, [ + {test, [ + {erl_opts, [nowarn_export_all]} + ]} +]}. diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 0000000..57afcca --- /dev/null +++ b/rebar.lock @@ -0,0 +1 @@ +[]. diff --git a/src/bench.erl b/src/bench.erl index e274c9d..ef681bb 100644 --- a/src/bench.erl +++ b/src/bench.erl @@ -1,21 +1,21 @@ -module(bench). --compile(export_all). +-export([sync/1, async/2, setup/0, print/3, loop/2]). sync(Num) -> Redo = setup(), - A = now(), + A = os:timestamp(), ok = loop(Redo, Num), - B = now(), + B = os:timestamp(), print(Num,A,B), ok. async(Num, Concurrency) -> Redo = setup(), Self = self(), - A = now(), + A = os:timestamp(), Pids = [spawn_link(fun() -> loop(Redo, Num div Concurrency), Self ! {self(), done} end) || _ <- lists:seq(1, Concurrency)], [receive {Pid, done} -> ok end || Pid <- Pids], - B = now(), + B = os:timestamp(), print(Num,A,B), ok. diff --git a/src/redo_block.erl b/src/redo_block.erl index b8af0b1..3ef3295 100644 --- a/src/redo_block.erl +++ b/src/redo_block.erl @@ -175,7 +175,7 @@ schedule(S=#state{worker=undefined, opts=Opts}) -> case redo:start_link(undefined, Opts) of {ok, Worker} -> schedule(S#state{worker=Worker, worker_status=free}); - {stop, Err} -> + {error, Err} -> {error, Err} end; schedule(S=#state{worker=Pid, worker_status=free, timers=T, queue=Q}) -> diff --git a/src/redo_concurrency_test.erl b/src/redo_concurrency_test.erl index b0a6b0c..d610a9a 100644 --- a/src/redo_concurrency_test.erl +++ b/src/redo_concurrency_test.erl @@ -49,10 +49,9 @@ worker(Parent, N, 0) -> Parent ! {self(), N, done}; worker(Parent, N, NumOps) -> - random:seed(now()), StrN = integer_to_list(N), StrOp = integer_to_list(NumOps), - case random:uniform(100) of + case rand:uniform(100) of R when R > 0, R =< 24 -> Key = iolist_to_binary([StrN, ":", StrOp, ":STRING"]), Val = iolist_to_binary(["STRING:", StrN, ":", StrOp]), diff --git a/test/redo_block_tests.erl b/test/redo_block_tests.erl index 5b80348..7ecef63 100644 --- a/test/redo_block_tests.erl +++ b/test/redo_block_tests.erl @@ -50,7 +50,7 @@ seq_test_() -> fun start/0, fun stop/1, fun(Pid) -> - Key = lists:flatten(io_lib:format("~p-~p", [make_ref(),now()])), + Key = lists:flatten(io_lib:format("~p-~p", [make_ref(),os:timestamp()])), Cmds = [redo_block:cmd(Pid, ["EXISTS", Key]), redo_block:cmd(Pid, ["SET", Key, "1"]), redo_block:cmd(Pid, ["GET", Key]), @@ -71,7 +71,7 @@ parallel_test_() -> fun(Pid) -> Parent = self(), Keygen = fun() -> - iolist_to_binary(io_lib:format("~p-~p", [make_ref(),now()])) + iolist_to_binary(io_lib:format("~p-~p", [make_ref(),os:timestamp()])) end, %% Takes a unique key, inserts it, then reads it. With hundreds of concurrent %% processes, if redo_block doesn't behave well, the val read might be different @@ -97,7 +97,7 @@ timeout_test_() -> fun start/0, fun stop/1, fun(Pid) -> - Key = lists:flatten(io_lib:format("~p-~p", [make_ref(),now()])), + Key = lists:flatten(io_lib:format("~p-~p", [make_ref(),os:timestamp()])), Cmds = [redo_block:cmd(Pid, ["EXISTS", Key]), redo_block:cmd(Pid, ["SET", Key, "1"]), redo_block:cmd(Pid, ["GET", Key], 0), @@ -119,7 +119,7 @@ parallel_timeout_test_() -> fun(Pid) -> Parent = self(), Keygen = fun() -> - iolist_to_binary(io_lib:format("~p-~p", [make_ref(),now()])) + iolist_to_binary(io_lib:format("~p-~p", [make_ref(),os:timestamp()])) end, %% Takes a unique key, inserts it, then reads it. With hundreds of concurrent %% processes, if redo_block doesn't behave well, the val read might be different
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor