Skip to content

Commit e0bbfb6

Browse files
committed
update
1 parent b6edf8c commit e0bbfb6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

doc/global.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@
5151
5. But the global task manager only running one in the same cluster.
5252

5353
### Implementation
54-
1. checking if `global_jobs` is empty when ecron application starts.
55-
2. The process of global is finished when `global_jobs` is empty.
56-
3. `ecron_sup` would start `ecron_monitor`(gen_server), when `global_jobs` is not empty.
57-
4. `ecron_monitor` monitors node's status by [net_kernel:monitor_nodes(true)](http://erlang.org/doc/man/net_kernel.html#monitor_nodes-1), when it initializes.
54+
1. The top supervisor `ecron_sup` start at first.
55+
2. Nothing will happen if the `global_jobs` is empty.
56+
3. When `global_jobs` is not empty, `ecron_sup` would start_link `ecron_monitor` worker (gen_server).
57+
4. `ecron_monitor` subscribes node's up/down messages by [net_kernel:monitor_nodes(true)](http://erlang.org/doc/man/net_kernel.html#monitor_nodes-1), when it initializes.
5858
5. Checking if there is enough `ecron` process in the cluster(`global_quorum_size`).
59-
6. Trying to terminate global manager job process when `ecron` process's number less than `global_quorum_size`.
60-
7. Otherwise, trying to start a global manager job gen_server, This process register by [global:register_name/2](http://erlang.org/doc/man/global.html#register_name-2).
61-
8. All nodes competitively register this global jobs manager process, only one node will success, other node's `ecron_monitor` only link this process.
62-
9. The `ecron_monitor` will receive notification, when node down/up or global jobs manager process die.
63-
10. Enter step 5 again, when receiving notification.
59+
6. Trying to terminate global job manager process when cluster's `ecron` number less than `global_quorum_size`.
60+
7. Otherwise, trying to start a global job manager process, This gen_server register by [global:register_name/2](http://erlang.org/doc/man/global.html#register_name-2).
61+
8. All the nodes are rushing to register this global jobs manager process, only one node will success, other node's `ecron_monitor` would link this process if the process already exists.
62+
9. The `ecron_monitor` will receive notification, when node down/up or the global job manager dies.
63+
10. Enter step 5 again, When notified.
6464

6565
```
6666
NodeA NodeB NodeC

0 commit comments

Comments
 (0)