kulesa-sidekiq 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. data/.gitignore +6 -0
  2. data/.rvmrc +4 -0
  3. data/COMM-LICENSE +83 -0
  4. data/Changes.md +207 -0
  5. data/Gemfile +12 -0
  6. data/LICENSE +22 -0
  7. data/README.md +61 -0
  8. data/Rakefile +9 -0
  9. data/bin/client +7 -0
  10. data/bin/sidekiq +14 -0
  11. data/bin/sidekiqctl +74 -0
  12. data/config.ru +18 -0
  13. data/examples/chef/cookbooks/sidekiq/README.rdoc +11 -0
  14. data/examples/chef/cookbooks/sidekiq/recipes/default.rb +55 -0
  15. data/examples/chef/cookbooks/sidekiq/templates/default/monitrc.conf.erb +8 -0
  16. data/examples/chef/cookbooks/sidekiq/templates/default/sidekiq.erb +219 -0
  17. data/examples/chef/cookbooks/sidekiq/templates/default/sidekiq.yml.erb +22 -0
  18. data/examples/clockwork.rb +44 -0
  19. data/examples/config.yml +10 -0
  20. data/examples/monitrc.conf +6 -0
  21. data/examples/por.rb +27 -0
  22. data/examples/scheduling.rb +37 -0
  23. data/examples/sinkiq.rb +59 -0
  24. data/examples/web-ui.png +0 -0
  25. data/lib/sidekiq.rb +98 -0
  26. data/lib/sidekiq/capistrano.rb +35 -0
  27. data/lib/sidekiq/cli.rb +214 -0
  28. data/lib/sidekiq/client.rb +72 -0
  29. data/lib/sidekiq/extensions/action_mailer.rb +26 -0
  30. data/lib/sidekiq/extensions/active_record.rb +27 -0
  31. data/lib/sidekiq/extensions/generic_proxy.rb +21 -0
  32. data/lib/sidekiq/fetch.rb +76 -0
  33. data/lib/sidekiq/logging.rb +46 -0
  34. data/lib/sidekiq/manager.rb +163 -0
  35. data/lib/sidekiq/middleware/chain.rb +96 -0
  36. data/lib/sidekiq/middleware/client/unique_jobs.rb +36 -0
  37. data/lib/sidekiq/middleware/server/active_record.rb +13 -0
  38. data/lib/sidekiq/middleware/server/exception_handler.rb +38 -0
  39. data/lib/sidekiq/middleware/server/failure_jobs.rb +25 -0
  40. data/lib/sidekiq/middleware/server/logging.rb +31 -0
  41. data/lib/sidekiq/middleware/server/retry_jobs.rb +69 -0
  42. data/lib/sidekiq/middleware/server/timeout.rb +21 -0
  43. data/lib/sidekiq/middleware/server/unique_jobs.rb +17 -0
  44. data/lib/sidekiq/processor.rb +92 -0
  45. data/lib/sidekiq/rails.rb +21 -0
  46. data/lib/sidekiq/redis_connection.rb +27 -0
  47. data/lib/sidekiq/retry.rb +59 -0
  48. data/lib/sidekiq/testing.rb +44 -0
  49. data/lib/sidekiq/testing/inline.rb +37 -0
  50. data/lib/sidekiq/util.rb +40 -0
  51. data/lib/sidekiq/version.rb +3 -0
  52. data/lib/sidekiq/web.rb +185 -0
  53. data/lib/sidekiq/worker.rb +62 -0
  54. data/lib/sidekiq/yaml_patch.rb +21 -0
  55. data/myapp/.gitignore +15 -0
  56. data/myapp/Capfile +5 -0
  57. data/myapp/Gemfile +19 -0
  58. data/myapp/Rakefile +7 -0
  59. data/myapp/app/controllers/application_controller.rb +3 -0
  60. data/myapp/app/controllers/work_controller.rb +38 -0
  61. data/myapp/app/helpers/application_helper.rb +2 -0
  62. data/myapp/app/mailers/.gitkeep +0 -0
  63. data/myapp/app/mailers/user_mailer.rb +9 -0
  64. data/myapp/app/models/.gitkeep +0 -0
  65. data/myapp/app/models/post.rb +5 -0
  66. data/myapp/app/views/layouts/application.html.erb +14 -0
  67. data/myapp/app/views/user_mailer/greetings.html.erb +3 -0
  68. data/myapp/app/views/work/index.html.erb +1 -0
  69. data/myapp/app/workers/hard_worker.rb +10 -0
  70. data/myapp/config.ru +4 -0
  71. data/myapp/config/application.rb +59 -0
  72. data/myapp/config/boot.rb +6 -0
  73. data/myapp/config/database.yml +25 -0
  74. data/myapp/config/deploy.rb +15 -0
  75. data/myapp/config/environment.rb +5 -0
  76. data/myapp/config/environments/development.rb +38 -0
  77. data/myapp/config/environments/production.rb +67 -0
  78. data/myapp/config/environments/test.rb +37 -0
  79. data/myapp/config/initializers/backtrace_silencers.rb +7 -0
  80. data/myapp/config/initializers/inflections.rb +15 -0
  81. data/myapp/config/initializers/mime_types.rb +5 -0
  82. data/myapp/config/initializers/secret_token.rb +7 -0
  83. data/myapp/config/initializers/session_store.rb +8 -0
  84. data/myapp/config/initializers/sidekiq.rb +6 -0
  85. data/myapp/config/initializers/wrap_parameters.rb +14 -0
  86. data/myapp/config/locales/en.yml +5 -0
  87. data/myapp/config/routes.rb +10 -0
  88. data/myapp/db/migrate/20120123214055_create_posts.rb +10 -0
  89. data/myapp/db/seeds.rb +7 -0
  90. data/myapp/lib/assets/.gitkeep +0 -0
  91. data/myapp/lib/tasks/.gitkeep +0 -0
  92. data/myapp/log/.gitkeep +0 -0
  93. data/myapp/script/rails +6 -0
  94. data/sidekiq.gemspec +27 -0
  95. data/test/config.yml +9 -0
  96. data/test/fake_env.rb +0 -0
  97. data/test/helper.rb +16 -0
  98. data/test/test_cli.rb +168 -0
  99. data/test/test_client.rb +119 -0
  100. data/test/test_extensions.rb +69 -0
  101. data/test/test_manager.rb +51 -0
  102. data/test/test_middleware.rb +92 -0
  103. data/test/test_processor.rb +32 -0
  104. data/test/test_retry.rb +125 -0
  105. data/test/test_stats.rb +68 -0
  106. data/test/test_testing.rb +97 -0
  107. data/test/test_testing_inline.rb +75 -0
  108. data/test/test_web.rb +122 -0
  109. data/web/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
  110. data/web/assets/images/bootstrap/glyphicons-halflings.png +0 -0
  111. data/web/assets/javascripts/application.js +20 -0
  112. data/web/assets/javascripts/vendor/bootstrap.js +12 -0
  113. data/web/assets/javascripts/vendor/bootstrap/bootstrap-alert.js +91 -0
  114. data/web/assets/javascripts/vendor/bootstrap/bootstrap-button.js +98 -0
  115. data/web/assets/javascripts/vendor/bootstrap/bootstrap-carousel.js +154 -0
  116. data/web/assets/javascripts/vendor/bootstrap/bootstrap-collapse.js +136 -0
  117. data/web/assets/javascripts/vendor/bootstrap/bootstrap-dropdown.js +92 -0
  118. data/web/assets/javascripts/vendor/bootstrap/bootstrap-modal.js +210 -0
  119. data/web/assets/javascripts/vendor/bootstrap/bootstrap-popover.js +95 -0
  120. data/web/assets/javascripts/vendor/bootstrap/bootstrap-scrollspy.js +125 -0
  121. data/web/assets/javascripts/vendor/bootstrap/bootstrap-tab.js +130 -0
  122. data/web/assets/javascripts/vendor/bootstrap/bootstrap-tooltip.js +270 -0
  123. data/web/assets/javascripts/vendor/bootstrap/bootstrap-transition.js +51 -0
  124. data/web/assets/javascripts/vendor/bootstrap/bootstrap-typeahead.js +271 -0
  125. data/web/assets/javascripts/vendor/jquery.js +9266 -0
  126. data/web/assets/javascripts/vendor/jquery.timeago.js +148 -0
  127. data/web/assets/stylesheets/application.css +27 -0
  128. data/web/assets/stylesheets/vendor/bootstrap-responsive.css +567 -0
  129. data/web/assets/stylesheets/vendor/bootstrap.css +3365 -0
  130. data/web/views/index.slim +48 -0
  131. data/web/views/layout.slim +26 -0
  132. data/web/views/queue.slim +11 -0
  133. data/web/views/retries.slim +29 -0
  134. data/web/views/retry.slim +52 -0
  135. metadata +371 -0
@@ -0,0 +1,6 @@
1
+ tags
2
+ Gemfile.lock
3
+ *.swp
4
+ dump.rdb
5
+ .rbx
6
+ coverage/
data/.rvmrc ADDED
@@ -0,0 +1,4 @@
1
+ export RUBYOPT="-Ilib:test"
2
+ export JRUBY_OPTS="--1.9"
3
+ rvm use 1.9.3@sidekiq --create
4
+ #rvm use jruby@sidekiq --create
@@ -0,0 +1,83 @@
1
+ THIS LICENSE AGREEMENT DESCRIBES YOUR RIGHTS WITH RESPECT TO THE SOFTWARE AND ITS COMPONENTS.
2
+
3
+ 1. OWNERSHIP, LICENSE GRANT
4
+
5
+ This is a license agreement and not an agreement for sale. We reserve ownership of all intellectual property rights inherent in or relating to the Software, which include, but are not limited to, all copyright, patent rights, all rights in relation to registered and unregistered trademarks (including service marks), confidential information (including trade secrets and know-how) and all rights other than those expressly granted by this License Agreement.
6
+
7
+ Subject to the payment of the fee required and subject to the terms and conditions of this License Agreement, We grant to You a revocable, non- transferable and non-exclusive license (i) for Designated User(s) (as defined below) within Your organization to install and use the Software on any workstations used exclusively by such Designated User and (ii) for You to install and use the Software in connection with unlimited domains and sub-domains on unlimited servers, solely in connection with distribution of the Software in accordance with sections 3 and 4 below. This license is not sublicensable except as explicitly set forth herein. “Designated User(s)” shall mean Your employee(s) acting within the scope of their employment or Your consultant(s) or contractor(s) acting within the scope of the services they provide for You or on Your behalf for whom You have purchased a license to use the Software.
8
+
9
+ In addition to the other terms contained herein, We grant to You a revocable, non- transferable and non-exclusive license to install and use the Software on a single computer (the “Trial License”) strictly for Your internal evaluation and review purposes and not for production purposes. This Trial License applies only if You have registered with Us for a Trial License of the Software and shall be effective for forty-five (45) consecutive days following the date of registration (“the Trial Period”). You may only register for a Trial License once in any eighteen month period. You agree not to use a Trial License for any purpose other than determining whether to purchase a license to the Software. You are explicitly not permitted to distribute the Software to any user outside the Organization on whose behalf you have undertaken this license. Your rights to use the Trial License will immediately terminate upon the earlier of (i) the expiration of the Trial Period, or (ii) such time that You purchase a license to the Software. We reserve the right to terminate Your Trial License at any time in Our absolute and sole discretion.
10
+
11
+ 2. PERMITTED USES, SOURCE CODE, MODIFICATIONS
12
+
13
+ We provide You with source code so that You can create Modifications of the original Software, where Modification means: a) any addition to or deletion from the contents of a file included in the original Software or previous Modifications created by You, or b) any new file that contains any part of the original Software or previous Modifications. While You retain all rights to any original work authored by You as part of the Modifications, We continue to own all copyright and other intellectual property rights in the Software.
14
+
15
+ 3. DISTRIBUTION
16
+
17
+ You may distribute the Software in any applications, frameworks, or elements (collectively referred to as an “Application” or “Applications”) that you develop using the Software in accordance with this License Agreement, provided that such distribution does not violate the restrictions set forth in section 4 of this License Agreement. You must not remove, obscure or interfere with any copyright, acknowledgment, attribution, trademark, warning or disclaimer statement affixed to, incorporated in or otherwise applied in connection with the Software.
18
+
19
+ You are required to ensure that the Software is not reused by or with any applications other than those with which You distribute it as permitted herein. For example, if You install the Software on a customer’s server, that customer is not permitted to use the Software independently of Your application, and must be informed as such.
20
+
21
+ You will not owe Us any royalties for Your distribution of the Software in accordance with this License Agreement.
22
+
23
+ 4. PROHIBITED USES
24
+
25
+ You may not, without Our prior written consent, redistribute the Software or Modifications other than by including the Software or a portion thereof within Your own product, which must have substantially different functionality than the Software or Modifications and must not allow any third party to use the Software or Modifications, or any portions thereof, for software development or application development purposes. You are explicitly not allowed to redistribute the Software or Modifications as part of any product that can be described as a development toolkit or library, an application builder, a website builder or any product that is intended for use by software, application, or website developers or designers. You are not allowed to redistribute any part of the Software documentation. You may not change or remove the copyright notice from any of the files included in the Software or Modifications.
26
+
27
+ UNDER NO CIRCUMSTANCES MAY YOU USE THE SOFTWARE FOR A PRODUCT THAT IS INTENDED FOR SOFTWARE OR APPLICATION DEVELOPMENT PURPOSES.
28
+
29
+ The Open Source version of the Software (“LGPL Version”) is licensed
30
+ under the terms of the GNU Lesser General Public License versions 3.0
31
+ (“LGPL”) and not under this License Agreement. If You, or another third
32
+ party, has, at any time, developed all (or any portions of) the
33
+ Application(s) using the LGPL Version, You may not combine such
34
+ development work with the Software and must license such Application(s)
35
+ (or any portions derived there from) under the terms of the GNU Lesser
36
+ General Public License version 3, a copy of which is located at
37
+ http://www.gnu.org/copyleft/lgpl.html.
38
+
39
+ 5. TERMINATION
40
+
41
+ This License Agreement and Your right to use the Software and Modifications will terminate immediately without notice if You fail to comply with the terms and conditions of this License Agreement. Upon termination, You agree to immediately cease using and destroy the Software or Modifications, including all accompanying documents. The provisions of sections 4, 5, 6, 7, 8, 9, 10 and 12 will survive any termination of this License Agreement.
42
+
43
+ 6. DISCLAIMER OF WARRANTIES
44
+
45
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, WE AND OUR SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE. WE DO NOT GUARANTEE THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, AND YOU ACKNOWLEDGE THAT IT IS NOT TECHNICALLY PRACTICABLE FOR US TO DO SO.
46
+
47
+ 7. LIMITATION OF LIABILITIES
48
+
49
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL WE OR OUR SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION OR ANY OTHER PECUNIARY LAW) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, OUR ENTIRE LIABILITY UNDER ANY PROVISION OF THIS LICENSE AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR THE SOFTWARE.
50
+
51
+ 8. VERIFICATION
52
+
53
+ We or a certified auditor acting on Our behalf, may, upon its reasonable request and at its expense, audit You with respect to the use of the Software. Such audit may be conducted by mail, electronic means or through an in-person visit to Your place of business. Any such in-person audit shall be conducted during regular business hours at Your facilities and shall not unreasonably interfere with Your business activities. We shall not remove, copy, or redistribute any electronic material during the course of an audit. If an audit reveals that You are using the Software in a way that is in material violation of the terms of the License Agreement, then You shall pay Our reasonable costs of conducting the audit. In the case of a material violation, You agree to pay Us any amounts owing that are attributable to the unauthorized use. In the alternative, We reserve the right, at Our sole option, to terminate the licenses for the Software.
54
+
55
+ 9. THIRD PARTY SOFTWARE
56
+
57
+ Examples included in Software may provide links to third party libraries or code (collectively “Third Party Software”) to implement various functions. Third Party Software does not comprise part of the Software. In some cases, access to Third Party Software may be included along with the Software delivery as a convenience for demonstration purposes. Such source code and libraries may be included in the “…/examples” source tree delivered with the Software and do not comprise the Software. Licensee acknowledges (1) that some part of Third Party Software may require additional licensing of copyright and patents from the owners of such, and (2) that distribution of any of the Software referencing or including any portion of a Third Party Software may require appropriate licensing from such third parties.
58
+
59
+ 10. PAYMENT AND TAXES
60
+
61
+ If credit has been extended to You by Us, all payments under this License Agreement are due within thirty (30) days of the date We mail an invoice to You. If We have not extended credit to You, You shall be required to make payment concurrent with the delivery of the Software by Us. All amounts payable are gross amounts but exclusive of any value added tax, use tax, sales tax or similar tax. You shall be entitled to withhold from payments any applicable withholding taxes and comply with all applicable tax and employment legislation. Each party shall pay all taxes (including, but not limited to, taxes based upon its income) or levies imposed on it under applicable laws, regulations and tax treaties as a result of this Agreement and any payments made hereunder (including those required to be withheld or deducted from payments). Each party shall furnish evidence of such paid taxes as is sufficient to enable the other party to obtain any credits available to it, including original withholding tax certificates.
62
+
63
+ 11. MISCELLANEOUS
64
+
65
+ The license granted herein applies only to the version of the Software available when purchased in connection with the terms of this License Agreement. Any previous or subsequent license granted to You for use of the Software shall be governed by the terms and conditions of the agreement entered in connection with purchase of that version of the Software. You agree that you will comply with all applicable laws and regulations with respect to the Software, including without limitation all export and re-export control laws and regulations.
66
+
67
+ While redistributing the Software or Modifications thereof, You may choose to offer acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License Agreement. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on our behalf. You agree to indemnify, defend, and hold Us harmless from and against any liability incurred by, or claims asserted against, Us (i) by reason of Your accepting any such support, warranty, indemnity or additional liability; or (ii) arising out of the use, reproduction or distribution of Your Application, except to the extent such claim is solely based on the inclusion of the Software therein.
68
+
69
+ You agree to be identified as a customer of ours and You agree that We may refer to You by name, trade name and trademark, if applicable, and may briefly describe Your business in our marketing materials and web site.
70
+
71
+ You may not assign this License Agreement without Our prior written consent, which will not be unreasonably withheld. This License Agreement will inure to the benefit of Our successors and assigns.
72
+
73
+ You acknowledge that this License Agreement is complete and is the exclusive representation of our agreement. No oral or written information given by Us or on our behalf shall create a warranty or collateral contract, or in any way increase the scope of this License Agreement in any way, and You may not rely on any such oral or written information. No term or condition contained in any purchase order shall apply unless expressly accepted by Us in writing,
74
+
75
+ There are no implied licenses or other implied rights granted under this License Agreement, and all rights, save for those expressly granted hereunder, shall remain with Us and our licensors. In addition, no licenses or immunities are granted to the combination of the Software and/or Modifications, as applicable, with any other software or hardware not delivered by Us to You under this License Agreement.
76
+
77
+ If any provision in this License Agreement shall be determined to be invalid, such provision shall be deemed omitted; the remainder of this License Agreement shall continue in full force and effect. If any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of damages set forth in this License Agreement shall remain in effect.
78
+
79
+ This License Agreement may be modified only by a written instrument signed by an authorized representative of each party.
80
+
81
+ This License Agreement is governed by the law of the State of Oregon, United States (notwithstanding conflicts of laws provisions), and all parties irrevocably submit to the jurisdiction of the courts of the State of Oregon and further agree to commence any litigation which may arise hereunder in the state or federal courts located in the judicial district of Multnomah County, Oregon, US.
82
+
83
+ If the Software or any related documentation is licensed to the U.S. government or any agency thereof, it will be deemed to be “commercial computer software” or “commercial computer software documentation,” pursuant to DFAR Section 227.7202 and FAR Section 12.212. Any use of the Software or related documentation by the U.S. government will be governed solely by the terms of this License Agreement.
@@ -0,0 +1,207 @@
1
+ 1.2.1
2
+ -----------
3
+
4
+ - Sidekiq::Worker now has access to Sidekiq's standard logger
5
+ - Fix issue with non-StandardErrors leading to Processor exhaustion
6
+ - Fix issue with Fetcher slowing Sidekiq shutdown
7
+ - Print backtraces for all threads upon TTIN signal [#183]
8
+ - Overhaul retries Web UI with new index page and bulk operations [#184]
9
+
10
+ 1.2.0
11
+ -----------
12
+
13
+ - Full or partial error backtraces can optionally be stored as part of the retry
14
+ for display in the web UI if you aren't using an error service. [#155]
15
+
16
+ ```ruby
17
+ class Worker
18
+ include Sidekiq::Worker
19
+ sidekiq_options :backtrace => [true || 10]
20
+ end
21
+ ```
22
+ - Add timeout option to kill a worker after N seconds (blackgold9)
23
+
24
+ ```ruby
25
+ class HangingWorker
26
+ include Sidekiq::Worker
27
+ sidekiq_options :timeout => 600
28
+ def perform
29
+ # will be killed if it takes longer than 10 minutes
30
+ end
31
+ end
32
+ ```
33
+
34
+ - Fix delayed extensions not available in workers [#152]
35
+ - In test environments add the `#drain` class method to workers. This method
36
+ executes all previously queued jobs. (panthomakos)
37
+ - Sidekiq workers can be run inline during tests, just `require 'sidekiq/testing/inline'` (panthomakos)
38
+ - Queues can now be deleted from the Sidekiq web UI [#154]
39
+ - Fix unnecessary shutdown delay due to Retry Poller [#174]
40
+
41
+ 1.1.4
42
+ -----------
43
+
44
+ - Add 24 hr expiry for basic keys set in Redis, to avoid any possible leaking.
45
+ - Only register workers in Redis while working, to avoid lingering
46
+ workers [#156]
47
+ - Speed up shutdown significantly.
48
+
49
+ 1.1.3
50
+ -----------
51
+
52
+ - Better network error handling when fetching jobs from Redis.
53
+ Sidekiq will retry once per second until it can re-establish
54
+ a connection. (ryanlecompte)
55
+ - capistrano recipe now uses `bundle_cmd` if set [#147]
56
+ - handle multi\_json API changes (sferik)
57
+
58
+ 1.1.2
59
+ -----------
60
+
61
+ - Fix double restart with cap deploy [#137]
62
+
63
+ 1.1.1
64
+ -----------
65
+
66
+ - Set procline for easy monitoring of Sidekiq status via "ps aux"
67
+ - Fix race condition on shutdown [#134]
68
+ - Fix hang with cap sidekiq:start [#131]
69
+
70
+ 1.1.0
71
+ -----------
72
+
73
+ - The Sidekiq license has switched from GPLv3 to LGPLv3!
74
+ - Sidekiq::Client.push now returns whether the actual Redis
75
+ operation succeeded or not. [#123]
76
+ - Remove UniqueJobs from the default middleware chain. Its
77
+ functionality, while useful, is unexpected for new Sidekiq
78
+ users. You can re-enable it with the following config.
79
+ Read #119 for more discussion.
80
+
81
+ ```ruby
82
+ Sidekiq.configure_client do |config|
83
+ require 'sidekiq/middleware/client/unique_jobs'
84
+ config.client_middleware do |chain|
85
+ chain.add Sidekiq::Middleware::Client::UniqueJobs
86
+ end
87
+ end
88
+ Sidekiq.configure_server do |config|
89
+ require 'sidekiq/middleware/server/unique_jobs'
90
+ config.server_middleware do |chain|
91
+ chain.add Sidekiq::Middleware::Server::UniqueJobs
92
+ end
93
+ end
94
+ ```
95
+
96
+ 1.0.0
97
+ -----------
98
+
99
+ Thanks to all Sidekiq users and contributors for helping me
100
+ get to this big milestone!
101
+
102
+ - Default concurrency on client-side to 5, not 25 so we don't
103
+ create as many unused Redis connections, same as ActiveRecord's
104
+ default pool size.
105
+ - Ensure redis= is given a Hash or ConnectionPool.
106
+
107
+ 0.11.2
108
+ -----------
109
+
110
+ - Implement "safe shutdown". The messages for any workers that
111
+ are still busy when we hit the TERM timeout will be requeued in
112
+ Redis so the messages are not lost when the Sidekiq process exits.
113
+ [#110]
114
+ - Work around Celluloid's small 4kb stack limit [#115]
115
+ - Add support for a custom Capistrano role to limit Sidekiq to
116
+ a set of machines. [#113]
117
+
118
+ 0.11.1
119
+ -----------
120
+
121
+ - Fix fetch breaking retry when used with Redis namespaces. [#109]
122
+ - Redis connection now just a plain ConnectionPool, not CP::Wrapper.
123
+ - Capistrano initial deploy fix [#106]
124
+ - Re-implemented weighted queues support (ryanlecompte)
125
+
126
+ 0.11.0
127
+ -----------
128
+
129
+ - Client-side API changes, added sidekiq\_options for Sidekiq::Worker.
130
+ As a side effect of this change, the client API works on Ruby 1.8.
131
+ It's not officially supported but should work [#103]
132
+ - NO POLL! Sidekiq no longer polls Redis, leading to lower network
133
+ utilization and lower latency for message processing.
134
+ - Add --version CLI option
135
+
136
+ 0.10.1
137
+ -----------
138
+
139
+ - Add details page for jobs in retry queue (jcoene)
140
+ - Display relative timestamps in web interface (jcoene)
141
+ - Capistrano fixes (hinrik, bensie)
142
+
143
+ 0.10.0
144
+ -----------
145
+
146
+ - Reworked capistrano recipe to make it more fault-tolerant [#94].
147
+ - Automatic failure retry! Sidekiq will now save failed messages
148
+ and retry them, with an exponential backoff, over about 20 days.
149
+ Did a message fail to process? Just deploy a bug fix in the next
150
+ few days and Sidekiq will retry the message eventually.
151
+
152
+ 0.9.1
153
+ -----------
154
+
155
+ - Fix missed deprecations, poor method name in web UI
156
+
157
+ 0.9.0
158
+ -----------
159
+
160
+ - Add -t option to configure the TERM shutdown timeout
161
+ - TERM shutdown timeout is now configurable, defaults to 5 seconds.
162
+ - USR1 signal now stops Sidekiq from accepting new work,
163
+ capistrano sends USR1 at start of deploy and TERM at end of deploy
164
+ giving workers the maximum amount of time to finish.
165
+ - New Sidekiq::Web rack application available
166
+ - Updated Sidekiq.redis API
167
+
168
+ 0.8.0
169
+ -----------
170
+
171
+ - Remove :namespace and :server CLI options (mperham)
172
+ - Add ExceptionNotifier support (masterkain)
173
+ - Add capistrano support (mperham)
174
+ - Workers now log upon start and finish (mperham)
175
+ - Messages for terminated workers are now automatically requeued (mperham)
176
+ - Add support for Exceptional error reporting (bensie)
177
+
178
+ 0.7.0
179
+ -----------
180
+
181
+ - Example chef recipe and monitrc script (jc00ke)
182
+ - Refactor global configuration into Sidekiq.configure\_server and
183
+ Sidekiq.configure\_client blocks. (mperham)
184
+ - Add optional middleware FailureJobs which saves failed jobs to a
185
+ 'failed' queue (fbjork)
186
+ - Upon shutdown, workers are now terminated after 5 seconds. This is to
187
+ meet Heroku's hard limit of 10 seconds for a process to shutdown. (mperham)
188
+ - Refactor middleware API for simplicity, see sidekiq/middleware/chain. (mperham)
189
+ - Add `delay` extensions for ActionMailer and ActiveRecord. (mperham)
190
+ - Added config file support. See test/config.yml for an example file. (jc00ke)
191
+ - Added pidfile for tools like monit (jc00ke)
192
+
193
+ 0.6.0
194
+ -----------
195
+
196
+ - Resque-compatible processing stats in redis (mperham)
197
+ - Simple client testing support in sidekiq/testing (mperham)
198
+ - Plain old Ruby support via the -r cli flag (mperham)
199
+ - Refactored middleware support, introducing ability to add client-side middleware (ryanlecompte)
200
+ - Added middleware for ignoring duplicate jobs (ryanlecompte)
201
+ - Added middleware for displaying jobs in resque-web dashboard (maxjustus)
202
+ - Added redis namespacing support (maxjustus)
203
+
204
+ 0.5.1
205
+ -----------
206
+
207
+ - Initial release!
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+ gemspec
3
+
4
+ gem 'slim'
5
+ gem 'sprockets'
6
+ gem 'sass'
7
+ gem 'rails', '3.2.3'
8
+ gem 'sqlite3'
9
+
10
+ group :test do
11
+ gem 'simplecov', :require => false
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) Mike Perham
2
+
3
+ You may choose to license Sidekiq in one of two ways:
4
+
5
+ - Open Source under the LGPLv3
6
+
7
+ Please see <http://www.gnu.org/licenses/lgpl-3.0.html> for license text.
8
+
9
+ - Commercial License
10
+
11
+ The Sencha commercial software license in COMM-LICENSE. You must pledge
12
+ $50 to my Pledgie fund at http://www.pledgie.com/campaigns/16623 to use
13
+ this license.
14
+
15
+ The commercial license is just meant to help support my OSS work. If
16
+ you do buy the commercial licensing option, thank you for your support!
17
+
18
+ The commercial license is meant to be per-site. Consulting shops must buy
19
+ one license per client engagement which uses Sidekiq. For instance,
20
+ GitHub could license Sidekiq for $50 for their own internal use but they
21
+ must pay $50 per GitHub::FI install because FI is a separate installation
22
+ from the GitHub website managed by the FI customer.
@@ -0,0 +1,61 @@
1
+ Sidekiq
2
+ ==============
3
+
4
+ Simple, efficient message processing for Ruby.
5
+
6
+ Sidekiq uses threads to handle many messages at the same time in the
7
+ same process. It integrates tightly with Rails 3 to make background
8
+ message processing dead simple.
9
+
10
+ Sidekiq is compatible with Resque. It uses the exact same
11
+ message format as Resque so it can integrate into an existing Resque processing farm.
12
+ You can have Sidekiq and Resque run side-by-side at the same time and
13
+ use the Resque client to enqueue messages in Redis to be processed by Sidekiq.
14
+
15
+ At the same time, Sidekiq uses multithreading so it is much more memory efficient than
16
+ Resque (which forks a new process for every job). You'll find that you might need
17
+ 50 200MB resque processes to peg your CPU whereas one 300MB Sidekiq process will peg
18
+ the same CPU and perform the same amount of work. Please see [my blog post on Resque's memory
19
+ efficiency](http://blog.carbonfive.com/2011/09/16/improving-resques-memory-efficiency/)
20
+ and how I was able to shrink a Carbon Five client's resque processing farm
21
+ from 9 machines to 1 machine.
22
+
23
+
24
+ Requirements
25
+ -----------------
26
+
27
+ I test on Ruby 1.9.3 and JRuby 1.6.x in 1.9 mode. Other versions/VMs are
28
+ untested but I will do my best to support them. Ruby 1.8 is not supported.
29
+
30
+
31
+ Installation
32
+ -----------------
33
+
34
+ gem install sidekiq
35
+
36
+
37
+ Getting Started
38
+ -----------------
39
+
40
+ See the [sidekiq home page](http://mperham.github.com/sidekiq) for the simple 4-step process.
41
+
42
+
43
+ More Information
44
+ -----------------
45
+
46
+ Please see the [sidekiq wiki](https://github.com/mperham/sidekiq/wiki) for more information.
47
+ [#sidekiq on irc.freenode.net](irc://irc.freenode.net/#sidekiq) is dedicated to this project,
48
+ but bug reports or feature requests suggestions should still go through [issues on Github](https://github.com/mperham/sidekiq/issues).
49
+
50
+
51
+ License
52
+ -----------------
53
+
54
+ Please see LICENSE for licensing details.
55
+
56
+ <a href='http://www.pledgie.com/campaigns/16623'><img alt='Click here to lend your support to Open Source and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/16623.png?skin_name=chrome' border='0' /></a>
57
+
58
+ Author
59
+ -----------------
60
+
61
+ Mike Perham, [@mperham](https://twitter.com/mperham), [http://mikeperham.com](http://mikeperham.com)
@@ -0,0 +1,9 @@
1
+ require 'rake/testtask'
2
+ Rake::TestTask.new(:test) do |test|
3
+ test.libs << 'test'
4
+ #SO MUCH NOISE
5
+ #test.warning = true
6
+ test.pattern = 'test/**/test_*.rb'
7
+ end
8
+
9
+ task :default => :test
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sidekiq'
4
+
5
+ 10.times do
6
+ Sidekiq::Client.push('class' => 'HardWorker', 'args' => ['bob', 1])
7
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/sidekiq/cli'
4
+
5
+ begin
6
+ cli = Sidekiq::CLI.instance
7
+ cli.parse
8
+ cli.run
9
+ rescue => e
10
+ raise e if $DEBUG
11
+ STDERR.puts e.message
12
+ STDERR.puts e.backtrace.join("\n")
13
+ exit 1
14
+ end
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ class Sidekiqctl
6
+
7
+ attr_reader :stage, :pidfile, :timeout
8
+
9
+ def initialize(stage, pidfile, timeout)
10
+ @stage = stage
11
+ @pidfile = pidfile
12
+ @timeout = timeout
13
+
14
+ done 'No pidfile given' if !pidfile
15
+ done "Pidfile #{pidfile} does not exist" if !File.exist?(pidfile)
16
+ done 'Invalid pidfile content' if pid == 0
17
+
18
+ fetch_process
19
+
20
+ begin
21
+ send(stage)
22
+ rescue NoMethodError
23
+ done 'Invalid control command'
24
+ end
25
+ end
26
+
27
+ def fetch_process
28
+ Process.getpgid(pid)
29
+ rescue Errno::ESRCH
30
+ done "Process doesn't exist"
31
+ end
32
+
33
+ def done(msg)
34
+ puts msg
35
+ exit(0)
36
+ end
37
+
38
+ def pid
39
+ File.read(pidfile).to_i
40
+ end
41
+
42
+ def quiet
43
+ `kill -USR1 #{pid}`
44
+ end
45
+
46
+ def stop
47
+ `kill -TERM #{pid}`
48
+ timeout.times do
49
+ begin
50
+ Process.getpgid(pid)
51
+ rescue Errno::ESRCH
52
+ FileUtils.rm_f pidfile
53
+ done 'Sidekiq shut down gracefully.'
54
+ end
55
+ sleep 1
56
+ end
57
+ `kill -9 #{pid}`
58
+ FileUtils.rm_f pidfile
59
+ done 'Sidekiq shut down forcefully.'
60
+ end
61
+
62
+ def shutdown
63
+ quiet
64
+ stop
65
+ end
66
+
67
+ end
68
+
69
+ stage = ARGV[0]
70
+ pidfile = ARGV[1]
71
+ timeout = ARGV[2].to_i
72
+ timeout = 10 if timeout == 0
73
+
74
+ Sidekiqctl.new(stage, pidfile, timeout)