collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Reloading module while running?  (Read 2330 times)

0 Members and 1 Guest are viewing this topic.

Offline Dochere

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Reloading module while running?
« on: April 16, 2010, 07:48:02 am »
Would it be possible to reload a module while bot is running in any way?



I'm adding ALOT of new features to the bot I'm running, and honestly people on it ain't too happy with me updating the bot several times a day. With about 500 active members (2600 total) and about 60 of those are in the group channel at any given time, they are starting to get tired of all my quick restarts. (heh not like i do this every day, but the days when im pushing out new updates)


I have 2 bots, bot #2 is a backupbot that i use to develop mods before they go live. So about 9 of 10 times mods working on backupbot requires no modifications to run on the live bot. So in theory reloading the module should not produce any errors.


/Dochere
« Last Edit: April 16, 2010, 09:16:37 am by Dochere »

Offline Yite

  • BeBot Apprentice
  • ***
  • Posts: 152
  • Karma: +0/-0
    • Niflheim - Crom
Re: Reloading module while running?
« Reply #1 on: April 16, 2010, 09:50:59 am »
Loading a module is not an issue while the bot is running. However PHP provides no way for us to unload current functions and classes afaik.

This has been discussed internally in the past, and the verdict was that it's simply not possible to do within the constraints PHP gives us.
-Yite [Crom]

Offline Dochere

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Reloading module while running?
« Reply #2 on: April 16, 2010, 11:11:16 am »
Oh thanks, I knew I had read somewere that it was not possible but I could not find it when I was looking for it earlier.

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Reloading module while running?
« Reply #3 on: April 16, 2010, 07:50:08 pm »
I have a second bot running as silently as possible that I use when testing modules.  Doesn't give any messages when people log in or level or anything like that.  I only have it running when I am testing something new.  Then once I finish the testing I move the module over to the real bot and restart just the one time.

Offline Dochere

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Reloading module while running?
« Reply #4 on: April 17, 2010, 01:21:48 am »
Same as i do, though not all modules i wirte can be tested with dryrun. Actually most mods iwe done cannot be tested on the devbot. But yeah i try to keep it at a minimum on the live bot.

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: Reloading module while running?
« Reply #5 on: April 17, 2010, 09:04:45 am »
I've been cracking my head over this one too (as it's a very interesting problem actually).

If only PHP had anonymous classes or a way to 'free up'/unload a class name (knowing I already got rid of all references myself), then I'm certain I could make run-time loading/reloading work.
I do have a few other ideas floating in the back of my head, but it would likely change the way plugins work.

But there is a 'next best thing' while you're devving.
Take the content of a method you're heavily editing, put it in a separate file and include that file from your plugins' method.
This will cause the code to be read on each call and will always use the latest version of your code.
« Last Edit: April 17, 2010, 09:10:22 am by Vhab »

Offline Dochere

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Reloading module while running?
« Reply #6 on: June 04, 2010, 10:00:25 am »
Hers an idea:


Raid channel ran by 2 bots.

Bot 1: Private Group Bot, this bot only keeps the channel alive and invites people.
Bot 2: Modules Bot, does all other tasks that bot 1 would normally do.


Now you could restart Bot 2 without having shut channel down. And all the uses would see is that "Bot 2 left the channel. Bot 2 has joined the channel." And Bot 1 would basically never needed to be restarted as it only runs a few core functions.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 672
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal