Old Taskscheduler still runs after auto reloading extensions

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

Old Taskscheduler still runs after auto reloading extensions

Post by marsoups »

Hi,

I have a question about the task scheduler (sfs.getTaskScheduler()). I have noticed that if I have some scheduled tasks running, and frequently have extensions reload (to smoothly update the software without requiring a restart), or during development, that sometimes some of the old tasks are still running in the background, and this adds up over time so I have a situation where I can see schedules are running multiple times.

Is there a way to safely shut down and end a task (in the old "instance") when the extension is reloaded during an update situation ?

Many thanks for your help!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Old Taskscheduler still runs after auto reloading extensions

Post by Lapo »

Hi,
are we talking about SFS2X? I ask because this was posted under SFS 1.x...

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

Re: Old Taskscheduler still runs after auto reloading extensions

Post by marsoups »

Hi, yes my apologies. Are you able to move this thread?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Old Taskscheduler still runs after auto reloading extensions

Post by Lapo »

marsoups wrote:Hi, yes my apologies. Are you able to move this thread?
Sure, done :)

Back to your question, you just need to keep a reference to every task that was added to the Scheduler, so that you can cancel them in your Extension's destroy() method.

Take a look here for an example:
https://smartfoxserver.com/blog/how-to- ... extension/

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply