diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index be32b22d6..5d8e6f5dd 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -303,8 +303,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vectorRun(); } diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 60498c7cc..14d0cdbc6 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -431,6 +431,9 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi ReplayLog(aclient); + if (endpoint->GetZone() == Zone::GetLocalZone()) + UpdateObjectAuthority(); + Log(LogInformation, "ApiListener") << "Finished sending replay log for endpoint '" << endpoint->GetName() << "'."; } catch (const std::exception& ex) { diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index d4cb5e540..895524f69 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -98,7 +98,7 @@ public: static Value HelloAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params); - static void UpdateObjectAuthorityAsync(void); + static void UpdateObjectAuthority(void); protected: virtual void OnConfigLoaded(void) override; diff --git a/lib/remote/authority.cpp b/lib/remote/authority.cpp index cb81fa927..868ff0eba 100644 --- a/lib/remote/authority.cpp +++ b/lib/remote/authority.cpp @@ -34,7 +34,7 @@ static bool ObjectNameLessComparer(const ConfigObject::Ptr& a, const ConfigObjec return a->GetName() < b->GetName(); } -static void AuthorityTimerHandler(void) +void ApiListener::UpdateObjectAuthority(void) { Zone::Ptr my_zone = Zone::GetLocalZone(); @@ -80,16 +80,11 @@ static void AuthorityTimerHandler(void) } } -void ApiListener::UpdateObjectAuthorityAsync(void) -{ - l_AuthorityTimer->Reschedule(0); -} - static void StaticInitialize(void) { l_AuthorityTimer = new Timer(); - l_AuthorityTimer->OnTimerExpired.connect(boost::bind(&AuthorityTimerHandler)); - l_AuthorityTimer->SetInterval(15); + l_AuthorityTimer->OnTimerExpired.connect(boost::bind(&ApiListener::UpdateObjectAuthority)); + l_AuthorityTimer->SetInterval(30); l_AuthorityTimer->Start(); } diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index 0656aac79..107caa4d1 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -19,6 +19,7 @@ #include "remote/configobjectutility.hpp" #include "remote/configpackageutility.hpp" +#include "remote/apilistener.hpp" #include "config/configcompiler.hpp" #include "config/configitem.hpp" #include "base/configwriter.hpp" @@ -149,6 +150,8 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full return false; } + + ApiListener::UpdateObjectAuthority(); } catch (const std::exception& ex) { delete expr;