Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed May 12, 2017
1 parent dcdd7bb commit e14f88a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.0

- Emit extra data via `pre_term` callback before puma worker killer terminates a worker #49.

## 0.0.7

- Logging is configurable #41
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ PumaWorkerKiller.config do |config|
config.rolling_restart_frequency = 12 * 3600 # 12 hours in seconds
config.reaper_status_logs = true # setting this to false will not log lines like:
# PumaWorkerKiller: Consuming 54.34765625 mb with master and 2 workers.
config.pre_term = -> (worker) {} #nop

config.pre_term = -> (worker) { puts "Worker #{worker.inspect} being killed" }
end
PumaWorkerKiller.start
```
Expand All @@ -115,6 +115,20 @@ PumaWorkerKiller.start

`config.pre_term` will be called just prior to worker termination with the worker that is about to be terminated. This may be useful to use in keeping track of metrics, time of day workers are restarted, etc.

By default Puma Worker Killer will emit a log when a worker is being killed

```
PumaWorkerKiller: Out of memory. 5 workers consuming total: 500 mb out of max: 450 mb. Sending TERM to pid 23 consuming 53 mb.
```

or

```
PumaWorkerKiller: Rolling Restart. 5 workers consuming total: 650mb mb. Sending TERM to pid 34.
```

However you may want to collect more data, such as sending an event to an error collection service like rollbar or airbrake. The `pre_term` lambda gets called before any worker is killed by PWK for any reason.

## Attention

If you start puma as a daemon, to add puma worker killer config into puma config file, rather than into initializers:
Expand Down
2 changes: 1 addition & 1 deletion lib/puma_worker_killer/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module PumaWorkerKiller
VERSION = "0.0.8"
VERSION = "0.1.0"
end

0 comments on commit e14f88a

Please sign in to comment.