1408.1.1
|
|
|
John Arbash Meinel |
10 years ago
|
|
|
1408
|
|
|
Tim Penhey |
10 years ago
|
|
|
1407
|
|
|
Tim Penhey |
10 years ago
|
|
|
1406
|
|
|
Tim Penhey |
10 years ago
|
|
|
1405
|
|
|
Dimiter Naydenov |
10 years ago
|
|
|
1404
|
|
|
Alberto Donato |
10 years ago
|
|
|
1403
|
|
|
Dimiter Naydenov |
10 years ago
|
|
|
1402
|
|
|
William Reade |
10 years ago
|
|
|
1401
|
|
|
John Arbash Meinel |
10 years ago
|
|
|
1400
|
|
[r=jameinel] worker/notifyworker.go: Common worker logic
While I was looking to implement Upgrader as a worker, I realized that there was a lot of bits necessary to implement a Worker. You have to integrate with a tomb, and monitor the worker, and handle a modest interface, etc. It isn't a terrible amount, but it turns out to be a lot of boilerplate that actually takes a lot if you want to test all the edge cases.
This patch pulls all of that edge-case logic into a NotifyWorker helper. Essentially you implement a smaller api (WatchHandler), and hand that to the NotifyWorker. It then handles all the logic about shutting down cleanly, and you just integrate your couple of actions based on triggers.
I have a follow up patch so you can see what the Cleaner worker looks like with this change.
Probably the biggest advantage of this patch is that I have a very well tested edge-case-handling code, which can now just be re-used for all the other workers, and you don't have to worry about if your code is stopping the watcher it started, or if it is shutting down at the right time, etc.
https://codereview.appspot.com/10978043/
|
John Arbash Meinel |
10 years ago
|
|
|
1399
|
|
|
John Arbash Meinel |
10 years ago
|
|
|
1398
|
|
|
jtv at canonical |
10 years ago
|
|
|
1397
|
|
|
John Arbash Meinel |
10 years ago
|
|
|
1396
|
|
|
John Arbash Meinel |
10 years ago
|
|
|
1395
|
|
|
Raphael Badin |
10 years ago
|
|
|
1394
|
|
|
Ian Booth |
10 years ago
|
|
|
1393
|
|
|
Ian Booth |
10 years ago
|
|
|
1392
|
|
|
Tim Penhey |
10 years ago
|
|
|
1391
|
|
|
Tim Penhey |
10 years ago
|
|
|
1390
|
|
|
John Arbash Meinel |
10 years ago
|
|
|