Skip to content

Commit

Permalink
initialize reactor in wubot-monitor
Browse files Browse the repository at this point in the history
  - prevent generating many instances of reactors, each of which have to re-initialize reactor plugins
  • Loading branch information
wu committed Oct 1, 2011
1 parent 54dbf54 commit 23e7839
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/wubot-monitor
Expand Up @@ -41,6 +41,8 @@ my $schedule;

my $config = App::Wubot::Config->new( { root => $config_directory } );

my $reactor = App::Wubot::Reactor->new();

my $timelength = App::Wubot::Util::TimeLength->new();

# all the plugins share a message store object rather than letting
Expand Down Expand Up @@ -81,6 +83,7 @@ my $timer = AnyEvent->timer( after => 1,
next if $time > $now;

for my $plugin ( @{ $schedule->{$time} } ) {

my $plugin_config = $config->get_plugin_config( $plugin );

my $results = $plugin_objs->{$plugin}->check( $plugin_config );
Expand Down Expand Up @@ -143,6 +146,7 @@ sub create_plugin_instance {
cache_file => "$cache_directory/$plugin.yaml",
key => $plugin,
reactor_queue => $message_store,
wubot_reactor => $reactor,
} );

$plugin_objs->{ $plugin }->init( $plugin_config );
Expand Down

0 comments on commit 23e7839

Please sign in to comment.