otp

What's the best way to do something periodically in Erlang?

点点圈 提交于 2019-11-28 03:58:04
I have a process that needs to do some work every fifteen seconds. I'm currently doing it like this: -behavior(gen_server). interval_milliseconds ()-> 15000. init()-> {ok, _State = FascinatingStateData, _TimeoutInterval = interval_milliseconds () }. %% This gets called automatically as a result of our handlers %% including the optional _TimeoutInterval value in the returned %% Result handle_info(timeout, StateData)-> {noreply, _State = do_some_work(StateData), _TimeoutInterval = interval_milliseconds () }. This works, but it's extremely brittle: if I want to teach my server a new message, when

Achieving code swapping in Erlang's gen_server

浪子不回头ぞ 提交于 2019-11-27 17:15:39
I am looking to make use of Erlang's hot code swapping feature on a gen_server, so that I don't have to restart it. How should I do that? When I searched, all I could find was one article which mentioned that I need to make use of gen_server:code_change callback. However, I could not really find any documentation/examples on how to use this. Any help or links to resources greatly appreciated! As I already mentioned the normal way of upgrading is creating the proper .appup and .relup files, and let release_handler do what needs to be done. However you can manually execute the steps involved, as

OTP (token) should be automatically read from the message

拥有回忆 提交于 2019-11-27 10:57:02
I am working on an Android App, in which server sends an OTP and the user needs to enter this OTP in the App, to SignUp for my App. What I want is, that my App should be able to automatically read the OTP sent by the server. How can I achieve this? Any help or guidance in this regard would be highly appreciated. brijexecon I will recommend you not to use any third party libraries for auto fetch OTP from SMS Inbox. This can be done easily if you have basic understanding of Broadcast Receiver and how it works. Just Try following approach : Step 1) Create single interface i.e SmsListner package

What's the best way to do something periodically in Erlang?

怎甘沉沦 提交于 2019-11-27 00:14:22
问题 I have a process that needs to do some work every fifteen seconds. I'm currently doing it like this: -behavior(gen_server). interval_milliseconds ()-> 15000. init()-> {ok, _State = FascinatingStateData, _TimeoutInterval = interval_milliseconds () }. %% This gets called automatically as a result of our handlers %% including the optional _TimeoutInterval value in the returned %% Result handle_info(timeout, StateData)-> {noreply, _State = do_some_work(StateData), _TimeoutInterval = interval

Achieving code swapping in Erlang's gen_server

空扰寡人 提交于 2019-11-26 18:55:20
问题 I am looking to make use of Erlang's hot code swapping feature on a gen_server, so that I don't have to restart it. How should I do that? When I searched, all I could find was one article which mentioned that I need to make use of gen_server:code_change callback. However, I could not really find any documentation/examples on how to use this. Any help or links to resources greatly appreciated! 回答1: As I already mentioned the normal way of upgrading is creating the proper .appup and .relup