diff options
-rw-r--r-- | lib/POE/Component/Pg.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/POE/Component/Pg.pm b/lib/POE/Component/Pg.pm index 8217eeb..174ab60 100644 --- a/lib/POE/Component/Pg.pm +++ b/lib/POE/Component/Pg.pm @@ -207,8 +207,8 @@ sub addqueue { push @{$_[HEAP]{queue}}, $_[ARG0]; $_[KERNEL]->refcount_increment($_[ARG0][QSESID], 'P:C:PG'); - # if there's no query in progress, initiate query - if($_[HEAP]{state} == 0) { + # if there's no query in progress and we're connected, initiate query + if($_[HEAP]{state} == 0 && $_[HEAP]{dbi}) { $_[HEAP]{state} = 1; $_[KERNEL]->select_resume_write($_[HEAP]{fh}); } @@ -236,7 +236,7 @@ sub shutdown { sub process_queue { - if(@{$_[HEAP]{queue}}) { + if(@{$_[HEAP]{queue}} && $_[HEAP]{dbi}) { $_[HEAP]{state} = 1; $_[KERNEL]->select_resume_write($_[HEAP]{fh}); } else { |