[Jifty-commit] jifty branch, setupwizard-refactor, updated. 4b74fe610bdb2d3e9ae05ca7e6974359f30eeece
Jifty commits
jifty-commit at lists.jifty.org
Thu Jul 8 11:38:23 EDT 2010
The branch, setupwizard-refactor has been updated
via 4b74fe610bdb2d3e9ae05ca7e6974359f30eeece (commit)
from 2f82163e784e9d3171d33499d1b52ac5c4b307ea (commit)
Summary of changes:
lib/Jifty.pm | 30 ++++++++++++++++++++++++++++++
lib/Jifty/Plugin/Config/View.pm | 13 +------------
lib/Jifty/Schema.pm | 3 ++-
3 files changed, 33 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 4b74fe610bdb2d3e9ae05ca7e6974359f30eeece
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Jul 8 11:39:36 2010 -0400
Move soft restart logic into Jifty
diff --git a/lib/Jifty.pm b/lib/Jifty.pm
index 79f8b60..dcc4d74 100644
--- a/lib/Jifty.pm
+++ b/lib/Jifty.pm
@@ -264,6 +264,36 @@ sub new {
Jifty->call_trigger('post_init');
}
+=head2 restart
+
+Attempt to "soft" restart Jifty while still running.
+
+Currently this reloads the config from disk, sets up the database connections
+again, and calls the app-specific restart method if there is one.
+
+Possibly this should also reload plugins and use L<Module::Refresh>.
+
+=cut
+
+sub restart {
+ my $class = shift;
+
+ Jifty->log->info("Soft restarting Jifty while still running");
+
+ # reload config
+ Jifty->config->load();
+
+ # reconnect our database handle in case that config changed
+ Jifty->setup_database_connection();
+
+ # call the app's restart method if it has one
+ my $app = Jifty->app_class;
+ $app->restart()
+ if $app->can('restart');
+
+ # XXX: hook into plack::loader to restart server?
+}
+
# Explicitly destroy the classloader; if this happens during global
# destruction, there's a period of time where there's a bogus entry in
# @INC
diff --git a/lib/Jifty/Plugin/Config/View.pm b/lib/Jifty/Plugin/Config/View.pm
index 37fc7f0..7a67c0c 100644
--- a/lib/Jifty/Plugin/Config/View.pm
+++ b/lib/Jifty/Plugin/Config/View.pm
@@ -111,18 +111,7 @@ EOF
Jifty->handler->buffer->flush_output();
- # reload config
- Jifty->config->load();
-
- # reconnect our database handle in case that config changed
- Jifty->setup_database_connection();
-
- # call the app's restart method if it has one
- my $app = Jifty->app_class;
- $app->restart()
- if $app->can('restart');
-
- # XXX: hook into plack::loader to restart server
+ Jifty->restart();
};
1;
diff --git a/lib/Jifty/Schema.pm b/lib/Jifty/Schema.pm
index 3ba3ee3..1c9c275 100644
--- a/lib/Jifty/Schema.pm
+++ b/lib/Jifty/Schema.pm
@@ -130,7 +130,8 @@ sub serialize_current_schema {
=head2 setup_database
-Sets up or upgrades a new or existing Jifty database. It is used primarily by L<Jifty::Script::Schema>. Respects a number of flags set with L</flags>.
+Sets up or upgrades a new or existing Jifty database. It is used primarily by
+L<Jifty::Script::Schema>. Respects a number of flags set with L</flags>.
The methods it calls will die on error, so be sure to wrap any call to this
method in an C<eval>.
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list