active_waiter 0.3.2 → 0.3.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.
- checksums.yaml +4 -4
- data/README.md +26 -3
- data/app/views/active_waiter/jobs/_reload.html.erb +1 -1
- data/lib/active_waiter.rb +3 -2
- data/lib/active_waiter/configuration.rb +5 -1
- data/lib/active_waiter/store.rb +11 -0
- data/lib/active_waiter/version.rb +1 -1
- metadata +28 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68c332e792c09a74047e5bd43c141f56f0c9a884
|
4
|
+
data.tar.gz: 704c364920f7e00e2ee326f4821cfa88cd7bccc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 562bf267da981984180e6fa34ad21096c0ac3521d573ca9ffedead6f6bf5b1344e3cad03a13fab7b88496fcc941fd3ae32ddc7d328c7ecf271075a262333a84e
|
7
|
+
data.tar.gz: ead53d29b6d49e1e439e5b9c647ca363c6864cdab37f904ca43ec91386915a5c6bec0ffca83b42ec71ed68638f94b2f010ac8ef0c65716735ae8d18bce99062e
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ def index
|
|
37
37
|
format.html
|
38
38
|
format.pdf {
|
39
39
|
uid = ActiveWaiter.enqueue(ExportPdfJob, @things, current_user)
|
40
|
-
redirect_to active_waiter_path(uid)
|
40
|
+
redirect_to active_waiter_path(id: uid)
|
41
41
|
}
|
42
42
|
end
|
43
43
|
end
|
@@ -45,13 +45,13 @@ end
|
|
45
45
|
|
46
46
|
``` ruby
|
47
47
|
# routes.rb
|
48
|
-
mount ActiveWaiter::Engine => "/active_waiter
|
48
|
+
mount ActiveWaiter::Engine => "/active_waiter"
|
49
49
|
```
|
50
50
|
|
51
51
|
When the job completes, the user will be redirected to the `url` returned by the job. However, if you want the user to be presented with a download link, add `download: 1` params instead
|
52
52
|
|
53
53
|
``` ruby
|
54
|
-
redirect_to active_waiter_path(uid, download: 1)
|
54
|
+
redirect_to active_waiter_path(id: uid, download: 1)
|
55
55
|
```
|
56
56
|
|
57
57
|

|
@@ -108,6 +108,29 @@ Next, prefix any routes used in your application's layout with `main_app.`, e.g.
|
|
108
108
|
This is required because `ActiveWaiter` is a Rails Engine mounted into your application,
|
109
109
|
and it doesn't know about the routes declared within your application.
|
110
110
|
|
111
|
+
#### Changing the shared cache
|
112
|
+
|
113
|
+
For deploying in production environments, `ActiveWaiter` requires a shared cache to
|
114
|
+
track the status of downloads. By default it uses the Rails cache. If you want to
|
115
|
+
use something else other than the Rails cache like redis for example, you may specify
|
116
|
+
your own implementation:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
class RedisStore
|
120
|
+
def write(uid, value)
|
121
|
+
$redis.set("active_waiter:#{uid}", value)
|
122
|
+
end
|
123
|
+
|
124
|
+
def read(uid)
|
125
|
+
$redis.get("active_waiter:#{uid}")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
ActiveWaiter.configure do |config|
|
130
|
+
config.store = RedisStore.new
|
131
|
+
end
|
132
|
+
```
|
133
|
+
|
111
134
|
#### Exceptions
|
112
135
|
|
113
136
|
When your job gets an exception, the error message will be written in the error message and passed along
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<script>
|
2
|
-
setTimeout(function() { window.location.href = <%= url_for(params.merge(retries: @retries)).to_json.html_safe %>; }, 2000);
|
2
|
+
setTimeout(function() { window.location.href = <%= url_for(params.permit!.merge(retries: @retries)).to_json.html_safe %>; }, 2000);
|
3
3
|
</script>
|
data/lib/active_waiter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "active_waiter/engine"
|
2
|
+
require "active_waiter/store"
|
2
3
|
require "active_waiter/configuration"
|
3
4
|
require "active_waiter/job"
|
4
5
|
require "active_waiter/enumerable_job"
|
@@ -17,11 +18,11 @@ module ActiveWaiter
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def write(uid, value)
|
20
|
-
|
21
|
+
ActiveWaiter.configuration.store.write(uid, value)
|
21
22
|
end
|
22
23
|
|
23
24
|
def read(uid)
|
24
|
-
|
25
|
+
ActiveWaiter.configuration.store.read(uid)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_waiter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- choonkeat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: '5.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.2
|
29
|
+
version: '4.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: guard
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +72,20 @@ dependencies:
|
|
66
72
|
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rails-controller-testing
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
69
89
|
description: A simple mechanism allowing your users to wait for the completion of
|
70
90
|
your `ActiveJob`
|
71
91
|
email:
|
@@ -94,6 +114,7 @@ files:
|
|
94
114
|
- lib/active_waiter/engine.rb
|
95
115
|
- lib/active_waiter/enumerable_job.rb
|
96
116
|
- lib/active_waiter/job.rb
|
117
|
+
- lib/active_waiter/store.rb
|
97
118
|
- lib/active_waiter/version.rb
|
98
119
|
- lib/tasks/waiter_tasks.rake
|
99
120
|
homepage: https://github.com/choonkeat/active_waiter
|
@@ -116,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
137
|
version: '0'
|
117
138
|
requirements: []
|
118
139
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.5.2
|
120
141
|
signing_key:
|
121
142
|
specification_version: 4
|
122
143
|
summary: ActiveWaiter for background jobs to finish
|