ruby-libgearman 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/release.rb CHANGED
@@ -29,6 +29,6 @@
29
29
 
30
30
  class LibgearmanRelease
31
31
  def self.version
32
- return "0.10.2"
32
+ return "0.10.3"
33
33
  end
34
34
  end
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby-libgearman}
5
- s.version = "0.10.2"
5
+ s.version = "0.10.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Monty Taylor"]
9
9
  s.cert_chain = ["/home/mordred/.gnupg/gem-public_cert.pem"]
10
- s.date = %q{2009-10-23}
10
+ s.date = %q{2009-10-28}
11
11
  s.description = %q{These are the ruby wrappers for libgearman which can be used to provide Gearman Workers and to connect as Gearman Clients.}
12
12
  s.email = %q{mordred@inaugust.com}
13
13
  s.extensions = ["ext/extconf.rb"]
14
14
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "ext/extconf.rb", "ext/gearman.c"]
15
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "ext/extconf.rb", "ext/gearman.c", "release.rb", "test_client.rb", "ruby-libgearman.gemspec"]
15
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "ext/extconf.rb", "ext/gearman.c", "release.rb", "test_client.rb", "test_worker.rb", "ruby-libgearman.gemspec"]
16
16
  s.homepage = %q{http://launchpad.net/gearman-interface}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby-libgearman", "--main", "README"]
18
18
  s.require_paths = ["lib", "ext"]
data/test_worker.rb ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- mode: ruby; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3
+ # vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
+ # gearman-interface: Interface Wrappers for Gearman
5
+ # Copyright (c) 2009 Monty Taylor
6
+ # All rights reserved.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions are met:
10
+ #
11
+ # 1. Redistributions of source code must retain the above copyright
12
+ # notice, this list of conditions and the following disclaimer.
13
+ # 2. Redistributions in binary form must reproduce the above copyright
14
+ # notice, this list of conditions and the following disclaimer in the
15
+ # documentation and/or other materials provided with the distribution.
16
+ # 3. The name of the author may not be used to endorse or promote products
17
+ # derived from this software without specific prior written permission.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ require 'ext/gearman'
32
+
33
+ class WorkerCallback
34
+ def call(job)
35
+ workload= job.get_workload
36
+ func_name= job.function_name
37
+ unique_id= job.unique
38
+ puts "#{func_name}{#{unique_id}} called"
39
+ puts workload
40
+ return workload
41
+ end
42
+ end
43
+
44
+
45
+ worker = Gearman::Worker.new
46
+ worker.add_server('localhost')
47
+ worker.set_timeout(5000)
48
+ worker.add_function("worker_func", WorkerCallback.new)
49
+ ret= Gearman::GEARMAN_SUCCESS
50
+ while true
51
+ if ret == Gearman::GEARMAN_SUCCESS or ret == Gearman::GEARMAN_TIMEOUT
52
+ ret= worker.work()
53
+ if ret == Gearman::GEARMAN_TIMEOUT
54
+ puts "Hit timeout - restarting"
55
+ end
56
+ else
57
+ break
58
+ end
59
+ end
60
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-libgearman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Monty Taylor
@@ -30,7 +30,7 @@ cert_chain:
30
30
  JGdcSyZsTrRURg==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-10-23 00:00:00 -07:00
33
+ date: 2009-10-28 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies: []
36
36
 
@@ -56,6 +56,7 @@ files:
56
56
  - ext/gearman.c
57
57
  - release.rb
58
58
  - test_client.rb
59
+ - test_worker.rb
59
60
  - ruby-libgearman.gemspec
60
61
  has_rdoc: true
61
62
  homepage: http://launchpad.net/gearman-interface
metadata.gz.sig CHANGED
Binary file