ncr-background_fu 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,5 +1,10 @@
1
+ === 1.0.8 / 2008-07-30
2
+
3
+ * Reverted back to "text" column for storing job results so it works on PostgreSQL. [Trevor Turk, ncr]
4
+
1
5
  === 1.0.7 / 2008-07-16
2
6
 
7
+ * Updated docs and fixed a bug regarding started_at and Time.now.utc (the lack of #utc in some places resulted in jobs not starting). [Jeff Berg, ncr]
3
8
  * Fixed and refactored scaffolding. [ncr]
4
9
  * Removed deprecated Dependencies usage. [ncr]
5
10
  * Updated links in footer. [ncr]
data/README.txt CHANGED
@@ -125,7 +125,7 @@ Background tasks in Ruby On Rails made dead simple.
125
125
  == BONUS FEATURES:
126
126
 
127
127
  There are bonus features available if you set
128
- ActiveRecord::Base.allow_concurrency = true
128
+ config.active_record.allow_concurrency = true
129
129
  in your environment.
130
130
 
131
131
  These features are:
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{background_fu}
3
- s.version = "1.0.7"
3
+ s.version = "1.0.8"
4
4
 
5
5
  s.specification_version = 2 if s.respond_to? :specification_version=
6
6
 
@@ -11,7 +11,7 @@ else
11
11
  end
12
12
 
13
13
  loop do
14
- if job = Job.find(:first, :conditions => ["state='pending' and start_at <= ?", Time.now], :order => "priority desc, start_at asc")
14
+ if job = Job.find(:first, :conditions => ["state='pending' and start_at <= ?", Time.now.utc], :order => "priority desc, start_at asc")
15
15
  job.get_done!
16
16
  else
17
17
  RAILS_DEFAULT_LOGGER.info("BackgroundFu: Waiting for jobs...")
@@ -5,6 +5,8 @@ class CreateJobs < ActiveRecord::Migration
5
5
  t.string :worker_method
6
6
 
7
7
  t.text :args
8
+ t.text :result
9
+
8
10
  t.integer :priority
9
11
 
10
12
  t.integer :progress
@@ -15,8 +17,6 @@ class CreateJobs < ActiveRecord::Migration
15
17
  t.timestamp :start_at
16
18
  t.timestamp :started_at
17
19
  t.timestamps
18
-
19
- t.columns << 'result longtext' # text can store 65kb only, it's often too short
20
20
  end
21
21
 
22
22
  add_index :jobs, :state
data/lib/background_fu.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module BackgroundFu
2
2
 
3
- VERSION = "1.0.7"
3
+ VERSION = "1.0.8"
4
4
 
5
5
  end
data/lib/job.rb CHANGED
@@ -50,7 +50,7 @@ class Job < ActiveRecord::Base
50
50
  end
51
51
 
52
52
  def initialize_worker
53
- update_attributes!(:started_at => Time.now, :state => "running")
53
+ update_attributes!(:started_at => Time.now.utc, :state => "running")
54
54
  @worker = worker_class.constantize.new
55
55
  logger.info("BackgroundFu: Job initialized. Job(id: #{id}).")
56
56
  end
@@ -107,7 +107,7 @@ class Job < ActiveRecord::Base
107
107
  def setup_start_at
108
108
  return unless start_at.blank?
109
109
 
110
- self.start_at = Time.now
110
+ self.start_at = Time.now.utc
111
111
  end
112
112
 
113
113
  end
data/rails/init.rb CHANGED
@@ -3,7 +3,8 @@ require 'background_fu/worker_monitoring'
3
3
  require 'job'
4
4
  require 'job/bonus_features'
5
5
 
6
- ActiveSupport::Dependencies.load_paths << "#{RAILS_ROOT}/lib/workers"
6
+ # ActiveSupport::Dependencies will be here after edge becomes stable.
7
+ Dependencies.load_paths << "#{RAILS_ROOT}/lib/workers"
7
8
 
8
9
  if ActiveRecord::Base.allow_concurrency
9
10
  Job.send!(:include, Job::BonusFeatures)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncr-background_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacek Becela