From 9d4660206381baa0c5ff707e4de7913ae81251b4 Mon Sep 17 00:00:00 2001 From: Darin McBride Date: Sun, 28 Dec 2014 15:42:22 -0700 Subject: [PATCH] Buildings should no longer get stuck in upgrading state. --- lib/Lacuna/DB/Result/Building.pm | 12 +++++++++++- var/www/public/changes.txt | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index 2227e0b9..99d0ff47 100755 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -728,7 +728,17 @@ sub has_met_upgrade_prereqs { sub has_no_pending_build { my ($self) = @_; if ($self->is_upgrading) { - confess [1010, "You must complete the pending build first."]; + # sometimes the upgrade gets stuck, and someone has to jiggle + # the database. Detect the situation and jiggle the database + # immediately. + if ($self->upgrade_ends < DateTime->now) + { + $self->finish_upgrade(); + } + else + { + confess [1010, "You must complete the pending build first."]; + } } return 1; } diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 099ec264..34b681b2 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -6,6 +6,7 @@ - Mod: Sweepers adjusted for balance. - Fix: Most buildings should no longer ignore uni level. - Add: Overheating Parliament does damage. + - Fix: Buildings should no longer get stuck in upgrading state. 3.0908: - Mod: trash_messages_where now defaults to not returning deleted message IDs. -- 2.51.2