@@ -48,11 +48,9 @@ def initialize(opts = {})
4848 def post ( delay , *args , &task )
4949 raise ArgumentError . new ( 'no block given' ) unless block_given?
5050 return false unless running?
51- opts = {
52- executor : @task_executor ,
53- args : args ,
54- timer_set : self
55- }
51+ opts = { executor : @task_executor ,
52+ args : args ,
53+ timer_set : self }
5654 task = ScheduledTask . execute ( delay , opts , &task ) # may raise exception
5755 task . unscheduled? ? false : task
5856 end
@@ -74,11 +72,11 @@ def kill
7472 # @param [Hash] opts the options to create the object with.
7573 # @!visibility private
7674 def ns_initialize ( opts )
77- @queue = Collection ::NonConcurrentPriorityQueue . new ( order : :min )
78- @task_executor = Options . executor_from_options ( opts ) || Concurrent . global_io_executor
79- @timer_executor = SingleThreadExecutor . new
80- @condition = Event . new
81- @ruby_pid = $$ # detects if Ruby has forked
75+ @queue = Collection ::NonConcurrentPriorityQueue . new ( order : :min )
76+ @task_executor = Options . executor_from_options ( opts ) || Concurrent . global_io_executor
77+ @timer_executor = SingleThreadExecutor . new
78+ @condition = Event . new
79+ @ruby_pid = $$ # detects if Ruby has forked
8280 self . auto_terminate = opts . fetch ( :auto_terminate , true )
8381 end
8482
@@ -90,15 +88,15 @@ def ns_initialize(opts)
9088 #
9189 # @!visibility private
9290 def post_task ( task )
93- synchronize { ns_post_task ( task ) }
91+ synchronize { ns_post_task ( task ) }
9492 end
9593
9694 # @!visibility private
9795 def ns_post_task ( task )
9896 return false unless ns_running?
9997 ns_reset_if_forked
10098 if ( task . initial_delay ) <= 0.01
101- task . executor . post { task . process_task }
99+ task . executor . post { task . process_task }
102100 else
103101 @queue . push ( task )
104102 # only post the process method when the queue is empty
@@ -116,7 +114,7 @@ def ns_post_task(task)
116114 #
117115 # @!visibility private
118116 def remove_task ( task )
119- synchronize { @queue . delete ( task ) }
117+ synchronize { @queue . delete ( task ) }
120118 end
121119
122120 # `ExecutorService` callback called during shutdown.
@@ -148,7 +146,7 @@ def process_tasks
148146 task = synchronize { @condition . reset ; @queue . peek }
149147 break unless task
150148
151- now = Concurrent . monotonic_time
149+ now = Concurrent . monotonic_time
152150 diff = task . schedule_time - now
153151
154152 if diff <= 0
@@ -165,7 +163,7 @@ def process_tasks
165163 # queue now must have the same pop time, or a closer one, as
166164 # when we peeked).
167165 task = synchronize { @queue . pop }
168- task . executor . post { task . process_task }
166+ task . executor . post { task . process_task }
169167 else
170168 @condition . wait ( [ diff , 60 ] . min )
171169 end
0 commit comments