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

User avatar
marsoups
Posts: 164
Joined: 14 Apr 2008, 03:30

Old Taskscheduler still runs after auto reloading extensions

Postby marsoups » 24 Sep 2019, 09:13

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: 21016
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Old Taskscheduler still runs after auto reloading extensions

Postby Lapo » 24 Sep 2019, 14:47

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: 164
Joined: 14 Apr 2008, 03:30

Re: Old Taskscheduler still runs after auto reloading extensions

Postby marsoups » 25 Sep 2019, 06:47

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

Re: Old Taskscheduler still runs after auto reloading extensions

Postby Lapo » 25 Sep 2019, 07:12

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

Return to “SFS2X Questions”

Who is online

Users browsing this forum: LordDawn and 15 guests