How to use Timer::tick
?
#53
Replies: 3 comments
-
You can't launch an event loop (timer) before starting the server. You need to start the timer after the server worker is running by listening Also, most of the time you shouldn't call Swoole's functions directly. Instead, use a wrapped timer provided by Hyperf framework |
Beta Was this translation helpful? Give feedback.
-
@albertcht Ok but another problem is that, there are 8 workers, each of them run the timer, Couldn't we just run one timer in all workers? |
Beta Was this translation helpful? Give feedback.
-
Nevermind the event i used is MainWorkerStart |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Check List
Content
How and where should we use \Swoole\Timer ?
When i use it in ServiceProvider:
I'll get the following error when i ran:
php artisan serve
:Beta Was this translation helpful? Give feedback.
All reactions