Commit 2822e28b authored by Leigh B Stoller's avatar Leigh B Stoller

Another tweak to keep the queue of incoming notifications drained.

parent 47bf3768
......@@ -168,7 +168,7 @@ $SIG{HUP} = \&handler
GeniUtil::FlipToGeniUser();
# We process a lot of events!
event_set_sockbufsizes(1024 * 64, 1024 * 192);
event_set_sockbufsizes(1024 * 128, 1024 * 128);
#
# Capture all events from the local pubsubd and transform them into
......@@ -236,12 +236,25 @@ if (!event_subscribe($localhandle, \&callback, $tuple)) {
# Flag to know when there are no more events to process.
#
my $gotone;
my @notifications = ();
sub callback($$$)
{
my ($handle, $notification, $data) = @_;
$gotone++;
my $clone = event_notification_clone($handle, $notification);
if (!$clone) {
print STDERR "Could not clone notification\n";
return;
}
unshift(@notifications, $clone);
}
sub HandleNotification($$)
{
my ($handle, $notification) = @_;
my $site = event_notification_get_site($handle, $notification);
#
......@@ -416,6 +429,11 @@ while (1)
$gotone = 0;
event_poll($localhandle);
}
while (@notifications) {
my $notification = pop(@notifications);
HandleNotification($localhandle, $notification);
event_notification_free($localhandle, $notification);
}
event_poll_blocking($localhandle, 1000);
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment