Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Cvs P5ee > [svn:p5ee] r103...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 625 of 694
Post > Topic >>

[svn:p5ee] r10312 - p5ee/trunk/App-Context/lib/App/Context/POE

by spadkins@[EMAIL PROTECTED] Nov 26, 2007 at 01:23 PM

Author: spadkins
Date: Mon Nov 26 13:23:09 2007
New Revision: 10312

Modified:
   p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm

Log:
added unique_event_name and unique_event_method parameters to
send_async_event, allowing for the event to only be in
pending_async_events once (instead of piling up, like
_clear_pending_hotel_shop_requests was doing when splitting 20000
subrequests).  this seems to allow other POE events to run without too
much delay, so we can split massive amounts of subrequests and still keep
each of the nodes busy doing work.

Modified: p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm	(original)
+++ p5ee/trunk/App-Context/lib/App/Context/POE/Server.pm	Mon Nov 26
13:23:09 2007
@[EMAIL PROTECTED]
 -395,15 +395,39 @[EMAIL PROTECTED]
 
 sub send_async_event {
     &App::sub_entry if ($App::trace);
-    my ($self, $event, $callback_event) = @[EMAIL PROTECTED]
    my ($self, $event, $callback_event, $unique_event_name,
$unique_event_method) = @[EMAIL PROTECTED]
     my $event_token = $self->new_event_token();
     $event->{event_token} = $event_token;
     $callback_event->{event_token} = $event_token if ($callback_event);
-    push(@[EMAIL PROTECTED]
>{pending_async_events}}, [ $event, $callback_event ]);
+    if (   (   !$unique_event_name
+            && !$unique_event_method)
+        || (   $unique_event_name
+            && $unique_event_method
+            && ($self->count_in_pending_async_events($unique_event_name,
$unique_event_method) <= 1)) ) {
+        push(@[EMAIL PROTECTED]
>{pending_async_events}}, [ $event, $callback_event
]);
+    }
+
     &App::sub_exit($event_token) if ($App::trace);
     return($event_token);
 }
 
+sub count_in_pending_async_events {
+    &App::sub_entry if ($App::trace);
+    my ($self, $event_name, $event_method) = @[EMAIL PROTECTED]
    my $count = 0;
+    for my $pending_event (@[EMAIL PROTECTED]
>{pending_async_events}}) {
+        if (   ($pending_event->[0]->{name} eq $event_name)
+            && ($pending_event->[0]->{method} eq $event_method) ) {
+            $count++;
+        }
+    }
+
+    &App::sub_exit($count) if ($App::trace);
+    return($count);
+}
+
 sub new_event_token {
     &App::sub_entry if ($App::trace);
     my ($self) = @[EMAIL PROTECTED]





 1 Posts in Topic:
[svn:p5ee] r10312 - p5ee/trunk/App-Context/lib/App/Context/POE
spadkins@[EMAIL PROTECTED  2007-11-26 13:23:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 23:53:30 CDT 2008.