eriq-augustine / clefable

IRC Chatbot
6 stars 0 forks source link

Singleton Module #128

Closed clefable closed 11 years ago

clefable commented 12 years ago

Reported by eriq.

The current Singleton module breaks some stuff (like periodic actions and reloading core files). Either workaround or roll your own Singleton module.

eriq-augustine commented 11 years ago

This caused a bug where Clefable could not retrieve the correct channels.

channels() = {} @channels = {} getChannels() = {} Bot::instance::getChannels() = real channels

All of the above should return all the channels.

eriq-augustine commented 11 years ago

However, @emailMap can be referenced like this.

eriq-augustine commented 11 years ago

This happened because the Bot children needed to be Singleton w.r.t. the Bot base class. However, the threads need to be Singleton w.r.t. the child classes. The traditional Singleon module supplies the child singleton behavior.

Bot has been moved away from this module and implemented its own Singleton. Fixed in 9148be53aa061cc9319ac2651a638ff1baa8d04b.