導向器
警告
- 不要在你的計劃中使用
'count'=>infinity和元素restart。
喜歡:
Childspec = #{id => foo
,start => {bar, baz, [arg1, arg2]}
,plan => [restart]
,count => infinity}.
如果你的程序在崩潰後沒有啟動,導演將鎖定並重試重啟你的過程 3 次! 如果你使用 infinity 作為'count',請始終在'plan'中使用 {restart, MiliSeconds} 而不是 restart。
- 如果你有以下計劃:
Childspec1 = #{id => foo
,start => {bar, baz}
,plan => [restart,restart,delete,wait,wait, {restart, 4000}]
,count => infinity}.
Childspec2 = #{id => foo
,start => {bar, baz}
,plan => [restart,restart,stop,wait, {restart, 20000}, restart]
,count => infinity}.
Childspec3 = #{id => foo
,start => {bar, baz}
,plan => [restart,restart,stop,wait, {restart, 20000}, restart]
,count => 0}.
Childspec4 = #{id => foo
,start => {bar, baz}
,plan => []
,count => infinity}.
Childspec1 中 delete 元素的其餘部分和 Childspec2 中其餘的 stop 元素將永遠無法評估!
在 Childspec3 你想要執行你的計劃 0 次!
在 ChildSpec4 你沒有任何計劃執行 15 次!
- 當你使用
release_handler升級版本時,release_handler會呼叫supervisor:get_callback_module/1來獲取其回撥模組。
在 OTP <19get_callback_module/1中使用管理程式內部狀態記錄來給出其回撥模組。我們的主管不知道主管的內部狀態記錄,然後supervisor:get_callback_module/1與主管沒有合作。
好訊息是,在 OTP> = 19 時,supervisor:get_callback_module/1與導演 s :) 完美配合。
1> foo:start_link().
{ok,<0.105.0>}
2> supervisor:get_callback_module(foo_sup).
foo
3>