# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1336758923 -3600
# Node ID dab55c6f7710322d42a050497ad41badd89c9d42
# Parent  4ca9328e37d5fde876e2fe8eb0105ebda052eae3
moduleapi: Don't auto-reload self when already reloading (fixes reload of modules with cyclic dependencies)

diff -r 4ca9328e37d5 -r dab55c6f7710 core/moduleapi.lua
--- a/core/moduleapi.lua	Fri May 11 18:54:17 2012 +0100
+++ b/core/moduleapi.lua	Fri May 11 18:55:23 2012 +0100
@@ -112,7 +112,7 @@
 	if not self.dependencies then
 		self.dependencies = {};
 		self:hook("module-reloaded", function (event)
-			if self.dependencies[event.module] then
+			if self.dependencies[event.module] and not self.reloading then
 				self:log("info", "Auto-reloading due to reload of %s:%s", event.host, event.module);
 				modulemanager.reload(self.host, self.name);
 				return;