You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
This "Pluggy" process could be a named supervisor that starts the token cache and store the client_id and client_secret.
All operations receive the name of the instance of pluggy.
Pluggy.Webhooks.create(MyPluggy,params)
Start a token cache that uses an ets table an make all reads go directly to the ets table.
# exampledefmodulePluggy.CoolNameForTokenCachedouseGenServer@token_key:tokendefstart_link(opts)doname=Keyword.fetch!(opts,:name)GenServer.start_link(__MODULE__,opts,name: name)enddefinit(opts)doname=Keyword.fetch!(opts,:name):ets.new(table_name(name),[:set,:named_table,:protected,read_concurrency: true]){:ok,%{name: name}}enddefset(name,value)doGenServer.call(name,{:set,value})end# note that the lookup goes directly to the table without calling the genserver# removing the single process bottleneck that currently exists with the agentdefget(name)docase:ets.lookup(table_name(name),@token_key)do[{_key,value}]->{:ok,value}_->{:error,:not_found}endenddefhandle_call({:set,value},_from,state)do:ets.insert(table_name(state.name),{@token_key,value}){:reply,:ok,state}enddefptable_name(name),do: Module.concat(name,"TokeCache.Table")end
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Motivation
cc: @adrianolisboa @dmarasquin
Proposed solution
Principles behind the proposal:
Steps:
This "Pluggy" process could be a named supervisor that starts the token cache and store the client_id and client_secret.
The text was updated successfully, but these errors were encountered: