diff options
author | Robert Haas | 2010-08-10 17:25:24 +0000 |
---|---|---|
committer | Robert Haas | 2010-08-10 17:26:29 +0000 |
commit | f5867baaa98a100fb6445bb890e2ded73ae23625 (patch) | |
tree | 5ffefe3ec5089a49c478f1b081bc16ef3a525045 /perl-lib/PgCommitFest/Request.pm | |
parent | 44d7c5dbe25220bdef7469a42f29ce655c532383 (diff) |
Expire sessions after about one week, instead of at browser close.
In response to a gripe by Tom Lane.
Diffstat (limited to 'perl-lib/PgCommitFest/Request.pm')
-rw-r--r-- | perl-lib/PgCommitFest/Request.pm | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/perl-lib/PgCommitFest/Request.pm b/perl-lib/PgCommitFest/Request.pm index dc75d92..9710c5d 100644 --- a/perl-lib/PgCommitFest/Request.pm +++ b/perl-lib/PgCommitFest/Request.pm @@ -118,11 +118,10 @@ sub control { sub db { my ($self) = @_; - if (!defined $self->{'db'}) { - $self->{'db'} = - PgCommitFest::DB->connect($PG, $PGUSERNAME, $PGPASSWORD); - } - return $self->{'db'}; + return $self->{'db'} if ref $self && defined $self->{'db'}; + my $db = PgCommitFest::DB->connect($PG, $PGUSERNAME, $PGPASSWORD); + $self->{'db'} = $db if ref $self; + return $db; } sub db_is_connected { |