Class: Legion::Extensions::Actors::Once
- Inherits:
-
Object
- Object
- Legion::Extensions::Actors::Once
- Extended by:
- Dsl
- Includes:
- Base
- Defined in:
- lib/legion/extensions/actors/once.rb
Constant Summary
Constants included from Helpers::Base
Helpers::Base::NAMESPACE_BOUNDARIES
Instance Method Summary collapse
- #cancel ⇒ Object
- #delay ⇒ Object
-
#initialize ⇒ Once
constructor
A new instance of Once.
Methods included from Dsl
Methods included from Base
#args, #check_subtask?, #enabled?, #function, #generate_task?, included, #manual, #remote_invocable?, #runner, #use_runner?
Methods included from Helpers::Lex
#default_settings, included, #runner_desc
Methods included from Helpers::Base
#actor_class, #actor_const, #actor_name, #amqp_prefix, #calling_class, #calling_class_array, #from_json, #full_path, #lex_class, #lex_const, #lex_name, #lex_slug, #log_tag, #normalize, #runner_class, #runner_const, #runner_name, #segments, #settings_path, #table_prefix, #to_dotted_hash
Methods included from Helpers::Task
#generate_task_id, #generate_task_log, #task_update
Methods included from Helpers::Logger
Methods included from Helpers::Secret
reset_identity!, resolve_identity!, #secret
Methods included from Helpers::Core
Constructor Details
#initialize ⇒ Once
Returns a new instance of Once.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/legion/extensions/actors/once.rb', line 15 def initialize return unless enabled? if respond_to? :functions functions.each do function @task = Concurrent::ScheduledTask.execute(delay) do use_runner? ? runner : manual end end else @task = Concurrent::ScheduledTask.execute(delay) do use_runner? ? runner : manual end end rescue StandardError => e Legion::Logging.error e end |
Instance Method Details
#cancel ⇒ Object
38 39 40 41 42 |
# File 'lib/legion/extensions/actors/once.rb', line 38 def cancel return unless enabled? @task.cancel unless @task.cancelled? end |
#delay ⇒ Object
34 35 36 |
# File 'lib/legion/extensions/actors/once.rb', line 34 def delay 1.0 end |