ncr-background_fu 1.0.7 → 1.0.8
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/History.txt +5 -0
- data/README.txt +1 -1
- data/background-fu.gemspec +1 -1
- data/generators/background/templates/background.rb +1 -1
- data/generators/background/templates/migration.rb +2 -2
- data/lib/background_fu.rb +1 -1
- data/lib/job.rb +2 -2
- data/rails/init.rb +2 -1
- metadata +1 -1
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
|
-
|
128
|
+
config.active_record.allow_concurrency = true
|
129
129
|
in your environment.
|
130
130
|
|
131
131
|
These features are:
|
data/background-fu.gemspec
CHANGED
@@ -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
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
|
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)
|