diff options
| author | mo khan <mo@mokhan.ca> | 2013-08-28 07:20:13 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-08-28 07:20:13 -0600 |
| commit | db1191ec0e7305d684383f8974e2fa437f77ad5a (patch) | |
| tree | 5e27b197dff849d22d8e1f50eb75aa499b16bd06 /code/snippets/bg_process.rb | |
Diffstat (limited to 'code/snippets/bg_process.rb')
| -rw-r--r-- | code/snippets/bg_process.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/code/snippets/bg_process.rb b/code/snippets/bg_process.rb new file mode 100644 index 0000000..b7323e8 --- /dev/null +++ b/code/snippets/bg_process.rb @@ -0,0 +1,15 @@ +message = 'Good Morning' +recipient = 'tree@mybackyard.com' + +fork do + # In this contrived example the parent process forks a child to take + # care of sending data to the stats collector. Meanwhile the parent + # process has continued on with its work of sending the actual payload. + + # The parent process doesn't want to be slowed down with this task, and + # it doesn't matter if this would fail for some reason. + StatsCollector.record message, recipient +end + +# send message to recipient + |
