Skip to content

Commit

Permalink
Merge pull request #10 from maruthavanan/patch-1
Browse files Browse the repository at this point in the history
API to set global age of channels during runtime
  • Loading branch information
evanmiller committed Jan 17, 2013
2 parents 0d563ff + 8b73776 commit 0b85e33
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/tinymq.erl
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
-module(tinymq). -module(tinymq).


-export([now/1, poll/2, subscribe/3, push/2]). -export([now/1, poll/2, subscribe/3, push/2,set_global_age/1]).


%% @spec subscribe(Channel::string(), Timestamp::integer() | now | last, Subscriber::pid()) -> {ok, SubscribeTime} | {error, Reason} %% @spec subscribe(Channel::string(), Timestamp::integer() | now | last, Subscriber::pid()) -> {ok, SubscribeTime} | {error, Reason}
%% @doc Check `Channel' for messages created since `Timestamp' and send %% @doc Check `Channel' for messages created since `Timestamp' and send
Expand All @@ -25,3 +25,10 @@ push(Channel, Message) ->
%% @doc Retrieve the current time for the server managing `Channel'. %% @doc Retrieve the current time for the server managing `Channel'.
now(Channel) -> now(Channel) ->
gen_server:call(tinymq, {now, Channel}). gen_server:call(tinymq, {now, Channel}).

%% @spec set_global_age(NewMaxAge) -> ok
%% @doc Set new maximum age globally
%% This will change the maximum age of the channel to NewMaxAge.
%% Note: Channels created prior to this call will not have any effect.
set_global_age(NewMaxAge) ->
gen_server:cast(tinymq, {set_max_age, NewMaxAge}).

0 comments on commit 0b85e33

Please sign in to comment.