Achieving code swapping in Erlang's gen_server

前端 未结 5 782
北恋
北恋 2020-12-04 09:02

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

5条回答
  •  心在旅途
    2020-12-04 09:50

    The simplest way to do it is replace the .beam file and run l(my_server_module). in the shell. This bypasses the code_change function, and therefore requires that the representation of state hasn't changed.

    As mentioned already, the proper way to do it is to create a new release with appup and relup scripts. This new release is then installed with release_handler.

提交回复
热议问题