{"push_id":858941344,"size":1,"distinct_size":1,"ref":"refs/heads/jcr-add-worker-mixin","head":"80d95b2782d6a719fb17d5220d36b88ac185c215","before":"a01f2deaa6c12456afd2d8cbebf1cfa3003d6bce","commits":[{"sha":"80d95b2782d6a719fb17d5220d36b88ac185c215","author":{"email":"4ce87f5ca5596825d366b739cd5c4750d74e0217@gmail.com","name":"Collin Redding"},"message":"Add `Runner` and `Worker` mixin\n\nThis adds a `Runner` and `Worker` mixin. This is part of an effort\nto allow providing a custom worker class and in general make dat\nworker pool more flexible and powerful.\n\nThis adds a `Runner` which is built by a worker pool and passed\nto a worker. This is so we can remove the default worker callbacks\nthat the worker pool added to its workers for despawning workers\nand incrementing/decrementing waiting worker counts. Instead of\nusing the callbacks and relying on ruby's closures to allow\ncalling private methods on the worker pool, the worker now\ndirectly calls the runner. When the worker sleeps/wakes up it\ncalls a public increment/decrement method on the runner. When\nit shutsdown it calls the public despawn worker method on the\nrunner. The runner allows methods that are intended to be private\nand internal to the working of the worker pool to be public so\nthe worker can call them.\n\nAs part of adding a runner, the start and shutdown logic was\nmoved into the runner. This allows the runner to control the\norder the queue and workers are started the same way the worker\npool used to. Otherwise, the runner has to provide extra methods\nfor shutting down the workers and waiting on them to finish so\nthe worker pool can control the order.\n\nThis also adds a `Worker` mixin that will eventually be the base\nmixin that dat worker pool provides for defining custom workers.\nFor now, this moves the callbacks logic into it as class DSL\nmethods. This is a friendlier interface than the previous instance\nmethods. This also mixes in the `Worker` mixin into the default\nworker.\n\nAs part of changing the callbacks, this updates how a worker pool\nproxies the callback methods. The callbacks are stored on the class\nnot the instance of the default worker. The dat worker pool\ncallback methods functionally work the same but they access its\nworker class DSL methods. This will be removed once a worker class\ncan be passed to a worker pool as using the worker class DSL is\nthe preferred method to add callbacks.","distinct":true,"url":"https://api.github.com/repos/redding/dat-worker-pool/commits/80d95b2782d6a719fb17d5220d36b88ac185c215"}]}