summaryrefslogtreecommitdiff
path: root/lib/POE/Component/Pg.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-07-17 18:07:25 +0200
committerYorhel <git@yorhel.nl>2009-07-17 18:07:25 +0200
commit3aca4f551791a99503398fdfeceaf74bd56ba80e (patch)
tree084b67d5f772641ce6ded755702d866e0bcb0054 /lib/POE/Component/Pg.pm
parent43bb085304ae5646d4037d9b5778601e6b00dc19 (diff)
Don't process queries if we're not connected
Queries will now be queued untill we are connected. This may be what you want in some cases, but may not in other cases... At least it's the easiest way of handling DB requests without being connected.
Diffstat (limited to 'lib/POE/Component/Pg.pm')
-rw-r--r--lib/POE/Component/Pg.pm6
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 {