[Jifty-commit] jifty branch, pubsub, updated. 1.10518-107-ge0fe716

Jifty commits jifty-commit at lists.jifty.org
Sun Nov 4 02:08:06 EST 2012


The branch, pubsub has been updated
       via  e0fe716106b5dc0ac3f36bdefb139ab20a9f9902 (commit)
       via  8bf8bb431fa998fe8b8f4295d60e729696f18f3b (commit)
      from  9d59fe5e9ba99cf0af66384f3351aa0154b7aef3 (commit)

Summary of changes:
 lib/Jifty/Plugin/PubSub/Subscriptions.pm | 1 +
 lib/Jifty/Web/Session/JDBI.pm            | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 8bf8bb431fa998fe8b8f4295d60e729696f18f3b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Nov 4 02:00:52 2012 -0500

    Never assign to global (non-lexical) $_, due to AnyEvent event loop
    
    Any place wherein a postfix while assigns to $_, it is modifying the
    global $_, not the lexical $_ that for and map make use of.  This leads
    to the possibility of action at a distance -- particularly when in an
    event-driven context such as AnyEvent.
    
    Observed failure modes of global $_ being modified when running under
    Twiggy include unpredictable server hangs and spurious errors; these
    were much more common under 5.16.0 than under 5.10.1, for whatever
    reason.

diff --git a/lib/Jifty/Web/Session/JDBI.pm b/lib/Jifty/Web/Session/JDBI.pm
index ca113fd..256cdaf 100644
--- a/lib/Jifty/Web/Session/JDBI.pm
+++ b/lib/Jifty/Web/Session/JDBI.pm
@@ -218,7 +218,10 @@ sub remove_all {
     return unless $self->loaded;
     my $settings = Jifty::Model::SessionCollection->new;
     $settings->limit( column => "session_id", value => $self->id );
-    $_->delete while $_ = $settings->next;
+    while (my $setting = $settings->next) {
+        $setting->delete;
+    }
+
     $self->unload;
 }
 
@@ -239,7 +242,9 @@ sub continuations {
     $conts->limit( column => "session_id", value => $self->id );
 
     my %continuations;
-    $continuations{ $_->data_key } = $_->value while $_ = $conts->next;
+    while (my $cont = $conts->next) {
+        $continuations{ $cont->data_key } = $cont->value;
+    }
     return %continuations;
 }
 

commit e0fe716106b5dc0ac3f36bdefb139ab20a9f9902
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Nov 4 02:00:31 2012 -0500

    ->clear_for may be called before any subs are configured

diff --git a/lib/Jifty/Plugin/PubSub/Subscriptions.pm b/lib/Jifty/Plugin/PubSub/Subscriptions.pm
index 7854950..1861b2e 100644
--- a/lib/Jifty/Plugin/PubSub/Subscriptions.pm
+++ b/lib/Jifty/Plugin/PubSub/Subscriptions.pm
@@ -33,6 +33,7 @@ sub client_id {
 sub clear_for {
     my $self = shift;
     my ($region) = @_;
+    return unless $self->{client_id};
     $self->{store}{$self->{client_id}} = [
         grep { $_->{region} ne $region }
             @{$self->{store}{$self->{client_id}} }

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list