Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
supervisorとapplicationが停止する条件 ドキュメントをちゃんと読んでいれば, 当然知っているであろうことなのですが, 「セグフォも吐いてないのに何か死んでる!!」と焦ったことがあるので, 自分への戒めとして投稿します. supervisorの終了条件 To prevent a supervisor from getting into an infinite loop of child process terminations and restarts, a maximum restart intensity is defined using two integer values specified with the intensity and period keys in the above map. Assuming the values MaxR for inten
let it crashが生んだ誤解 ここ2年程のelixir人気に伴い, BEAM (つまりerlangとelixir) を使う人が増えました. しかし, let it crashという思想は誤解を残したまま世に広まったように感じています. 郷に入っては郷に従え. let it crashの思想をしっかり理解して実装していきたいものです. 前置き 大層なことを書きましたが, あくまでも個人的な見解であり, ポエムです. Erlang/OTPチームの見解とは異なる可能性がある点に気をつけてください. また, ご意見があればコメント欄に頂ければ幸いです. なお, Elixirのタグも付けていますが, 記事中のコードは全てErlangです. Elixirを書いている人にも知って欲しい, 「届けこの想い!」ということでタグは付けています. これらの点をご承知起きの上で読んで頂ければ幸いです.m(
defmodule SupervisorTest do use Application require Logger def start(_type, _args) do import Supervisor.Spec, warn: false # ここは:one_for_oneだと,しかもStashが死ぬと,エラーになる opts = [strategy: :one_for_all, name: SupervisorTest.Supervisor] children = [ # Stashの中からworker supervisorを起動したいので、ここのchildrenの中にworker supervisorを入れない worker(SupervisorTest.Stash, []) ] {:ok, sup}=Supervisor.start_link(children, opts) Lo
supervisorのメッセージキューが溜まる つい先日, supervisorのメッセージキューが溜まり続けていたので教訓として残す. start_child, terminate_child, etc...の実装について start_childを例に取る. 見ての通り, supervisorはgen_server behaviourで定義されており, start_childは内部的にはgen_server:call/3 (timeout: infinity) が呼ばれる. その後, ここでChildSpecに則り, 起動処理を行う. 起動処理は単純でerlang:apply/3の結果を見て, 成功していればChildSpecを保存・管理する. gen_serverの起動処理 子の起動処理として以下の関数をここでは以下を想定しよう. -module(hoge_server). -beha
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く