Skip to content

Instantly share code, notes, and snippets.

@dieswaytoofast
Created December 2, 2014 01:14
Show Gist options
  • Select an option

  • Save dieswaytoofast/6eae22b71d1febc04318 to your computer and use it in GitHub Desktop.

Select an option

Save dieswaytoofast/6eae22b71d1febc04318 to your computer and use it in GitHub Desktop.
perform_gc(Handler) ->
safe_cast(Handler, {perform_gc}).
init([{Party, _Client} = Account]) ->
% something here
{ok, Timer} = timer:apply_interval(?ACCOUNT_GC_TIMER, ?MODULE, perform_gc, [self()]),
State = #state{gc_timer = Timer}.
handle_cast({perform_gc}, State) ->
garbage_collect(),
{noreply, State}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment