1

I've been tasked with writing an IRC bot which will join channels on the internal IRC system here, and post messages to channels which don't appear to be used anymore, warning any potential users that the channel is about to be retired. Our IRC system has about 6,500 channels which need these messages posted to them, and the IRC server we use (a customised fork of Hybrid) limits concurrent channel joins to 100 per connection. In an attempt not to hit this limit, the code I've got is this :

if ($channel_list->{$channel}{joined}) {
    # If we're already joined, privmsg immediately
    $logger->info("Trying to message $channel");
    $data_entry->notified('true');
    $data_entry->update;
    $irc->yield(privmsg => $msg_channel, $message);
    $irc->yield(part => $msg_channel);
} else {
    # Otherwise join, and let the join event do the privmsg and part
    $logger->info("Trying to join $channel");
    $data_entry->notified('true');
    $data_entry->update;
    $irc->yield(join => $msg_channel);
}

i.e. it will see if we're joined already, and if we are, try to post the notification message, and then immediately part. If we're not joined, it tries to join first (and the join event will fire the message sending).

The problem is the code never seems to run the

$irc->yield(part => $msg_channel);

line, as eventually I start getting irc_405 events back from the IRC server saying the code has joined too many channels. Anyone got any idea what am I doing wrong?

GodEater
  • 3,445
  • 2
  • 27
  • 30
  • cross post at http://perlmonks.com/?node_id=1138295 – Dr.Avalanche Aug 12 '15 at 10:50
  • is posting to a completely seperate site not allowed or something? I presumed there would be somewhat different audiences... – GodEater Aug 12 '15 at 10:52
  • it's polite to tell people on each site that others may be working on the problem. You have answers on perl monks and have posted more information not included here. Failing to do so risks wasting peoples time – Dr.Avalanche Aug 12 '15 at 10:54
  • 1
    ah ha - gotcha. Will remember this in future - thank you. – GodEater Aug 12 '15 at 10:58

0 Answers0