Module: Procrastinate
- Defined in:
- lib/procrastinate.rb,
lib/procrastinate/server.rb,
lib/procrastinate/implicit.rb
Defined Under Namespace
Modules: SpawnStrategy, Task, Utils Classes: ChildDeath, Lock, ProcessManager, Proxy, Runtime, Scheduler, Server
Class Method Summary collapse
-
.join ⇒ void
Waits for all currently scheduled tasks to complete.
-
.proxy(obj) ⇒ Proxy
Creates a proxy that will execute methods called on obj in a child process.
-
.reset ⇒ Object
Resets the implicit scheduler.
-
.schedule(&block) ⇒ Task::Result
Schedules a block to be executed in its own thread.
-
.scheduler ⇒ Scheduler
Returns the scheduler instance.
-
.shutdown ⇒ Object
Internal method: You should not have to shutdown the scheduler manually since it consumes almost no resources when not active.
Class Method Details
.join ⇒ void
This method returns an undefined value.
Waits for all currently scheduled tasks to complete. This is like calling #value on all result objects, except that nothing is returned.
57 58 59 |
# File 'lib/procrastinate/implicit.rb', line 57 def join scheduler.join end |
.proxy(obj) ⇒ Proxy
Creates a proxy that will execute methods called on obj in a child process.
26 27 28 |
# File 'lib/procrastinate/implicit.rb', line 26 def proxy(obj) scheduler.proxy(obj) end |
.reset ⇒ Object
Resets the implicit scheduler. Please use this only in tests, not in production code.
76 77 78 79 |
# File 'lib/procrastinate/implicit.rb', line 76 def reset scheduler.shutdown @scheduler = nil end |
.schedule(&block) ⇒ Task::Result
Schedules a block to be executed in its own thread. Returns the future that will return the blocks return value.
41 42 43 |
# File 'lib/procrastinate/implicit.rb', line 41 def schedule(&block) scheduler.schedule(&block) end |
.scheduler ⇒ Scheduler
Returns the scheduler instance. When using procrastinate/implicit, there is one global scheduler to your ruby process, this one.
10 11 12 |
# File 'lib/procrastinate/implicit.rb', line 10 def scheduler @scheduler ||= Scheduler.start end |
.shutdown ⇒ Object
Internal method: You should not have to shutdown the scheduler manually since it consumes almost no resources when not active. This is mainly useful in tests to achieve isolation.
68 69 70 |
# File 'lib/procrastinate/implicit.rb', line 68 def shutdown scheduler.shutdown end |