Using fibers with timers

Options
Hi there, I have a noobish question,

I have a timer class that I create an instance of every time I need to do a countdown or have a game timer and I'm having a bit of a struggle trying to wrap my head around how to solve this server side. Would creating a fiber for each instance of these timers, for then to use ScheduleOnInterval to update the timers be wasteful? Would scheduling them on the main game fiber be better, or is there some other easy way of handling elapsed time?

Comments

  • chvetsov
    Options
    when implementing your timers you should take into account that eventually timer action is queued to fibers queue. so if you use rooms fiber, then your actions will be executed after some operation handling actions. this should not have big delay. but...

    from others side, if you will have extra fibers in room, then you will create concurrency issue for your self.
    so i would recommend to start with usage of rooms fiber
  • Skar
    Options
    I'll do that and see how it turns out, thanks!