You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lettimer=Repeater.every(.minutes(5), count:nil, tolerance:.seconds(1), queue:.global()){
// Some long running operation...
}
timer.fire()
Given the closure contains a relatively long-running operation, I use .global() queue for this purpose, but I want the closure to be run just after I schedule it because I need this operation to be run right now and not only after 5 mins.
Expected
The documentation doesn't tell me the aspects of force firing, so I think it is implied that the closure will be run in the queue that is given to the timer .
Actual
The closure is run in the current thread that may cause blocking of a blocking-sensible thread like the main.
Possible workaround
To fire the timer in a different queue.
DispatchQueue.global().async{ timer.fire()}
The text was updated successfully, but these errors were encountered:
Description
Example code:
Given the closure contains a relatively long-running operation, I use
.global()
queue for this purpose, but I want the closure to be run just after I schedule it because I need this operation to be run right now and not only after 5 mins.Expected
The documentation doesn't tell me the aspects of force firing, so I think it is implied that the closure will be run in the queue that is given to the timer .
Actual
The closure is run in the current thread that may cause blocking of a blocking-sensible thread like the main.
Possible workaround
To fire the timer in a different queue.
The text was updated successfully, but these errors were encountered: