@@ -98,6 +98,16 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
9898 /* update the object */
9999 double objVersion = params->Get (" version" );
100100
101+ auto deletedRuntimeObjects = listener->GetDeletedRuntimeObjects ();
102+ Dictionary::Ptr deletedInfo = deletedRuntimeObjects->Get (objName);
103+
104+ if (deletedInfo && deletedInfo->Get (" version" ) >= objVersion) {
105+ Log (LogWarning, " ApiListener" )
106+ << " Ignoring config update for deleted object '" << objName << " ' of type '" << objType << " ' from '"
107+ << identity << " ' (endpoint: '" << endpoint->GetName () << " ', zone: '" << endpointZone->GetName () << " ')" ;
108+ return Empty;
109+ }
110+
101111 Type::Ptr ptype = Type::GetByName (objType);
102112 auto *ctype = dynamic_cast <ConfigType *>(ptype.get ());
103113
@@ -437,6 +447,12 @@ void ApiListener::DeleteConfigObject(const ConfigObject::Ptr& object, const Mess
437447 if (object->GetPackage () != " _api" )
438448 return ;
439449
450+ Dictionary::Ptr deletionInfo = new Dictionary{
451+ {" version" , object->GetVersion ()},
452+ {" deleted" , Utility::GetTime ()},
453+ };
454+ GetDeletedRuntimeObjects ()->Set (object->GetName (), deletionInfo);
455+
440456 /* only send objects to zones which have access to the object */
441457 if (client) {
442458 Zone::Ptr target_zone = client->GetEndpoint ()->GetZone ();
@@ -508,3 +524,17 @@ void ApiListener::SendRuntimeConfigObjects(const JsonRpcConnection::Ptr& aclient
508524 Log (LogInformation, " ApiListener" )
509525 << " Finished syncing runtime objects to endpoint '" << endpoint->GetName () << " '." ;
510526}
527+
528+ void ApiListener::PruneDeletedRuntimeObjects ()
529+ {
530+ auto deletedRuntimeObjects = GetDeletedRuntimeObjects ();
531+ double cutoff = Utility::GetTime () - GetLocalEndpoint ()->GetLogDuration ();
532+ ObjectLock lock (deletedRuntimeObjects);
533+
534+ for (auto it = deletedRuntimeObjects->Begin (); it != deletedRuntimeObjects->End (); ++it) {
535+ Dictionary::Ptr deletedInfo = it->second ;
536+ if (deletedInfo->Get (" deleted" ) < cutoff) {
537+ deletedRuntimeObjects->Remove (it);
538+ };
539+ }
540+ }
0 commit comments