Merge pull request #7655 from sethalves/dont-spam-about-expired-actions

don't flood log with messages about expired actions
This commit is contained in:
Brad Hefta-Gaub 2016-04-14 09:32:56 -07:00
commit 285ebe8ec5
2 changed files with 18 additions and 9 deletions

View file

@ -14,6 +14,7 @@
#include <avatar/AvatarActionHold.h> #include <avatar/AvatarActionHold.h>
#include <ObjectActionOffset.h> #include <ObjectActionOffset.h>
#include <ObjectActionSpring.h> #include <ObjectActionSpring.h>
#include <LogHandler.h>
#include "InterfaceActionFactory.h" #include "InterfaceActionFactory.h"
@ -66,6 +67,8 @@ EntityActionPointer InterfaceActionFactory::factoryBA(EntityItemPointer ownerEnt
if (action) { if (action) {
action->deserialize(data); action->deserialize(data);
if (action->lifetimeIsOver()) { if (action->lifetimeIsOver()) {
static QString repeatedMessage =
LogHandler::getInstance().addRepeatedMessageRegex(".*factoryBA lifetimeIsOver during action creation.*");
qDebug() << "InterfaceActionFactory::factoryBA lifetimeIsOver during action creation --" qDebug() << "InterfaceActionFactory::factoryBA lifetimeIsOver during action creation --"
<< action->getExpires() << "<" << usecTimestampNow(); << action->getExpires() << "<" << usecTimestampNow();
return nullptr; return nullptr;

View file

@ -24,6 +24,7 @@
#include <RegisteredMetaTypes.h> #include <RegisteredMetaTypes.h>
#include <SharedUtil.h> // usecTimestampNow() #include <SharedUtil.h> // usecTimestampNow()
#include <SoundCache.h> #include <SoundCache.h>
#include <LogHandler.h>
#include "EntityScriptingInterface.h" #include "EntityScriptingInterface.h"
#include "EntitiesLogging.h" #include "EntitiesLogging.h"
@ -516,8 +517,8 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
EntityTreePointer tree = getTree(); EntityTreePointer tree = getTree();
if (tree && tree->isDeletedEntity(_id)) { if (tree && tree->isDeletedEntity(_id)) {
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
qDebug() << "Received packet for previously deleted entity [" << _id << "] ignoring. " qCDebug(entities) << "Received packet for previously deleted entity [" << _id << "] ignoring. "
"(inside " << __FUNCTION__ << ")"; "(inside " << __FUNCTION__ << ")";
#endif #endif
ignoreServerPacket = true; ignoreServerPacket = true;
} }
@ -1685,7 +1686,7 @@ bool EntityItem::addActionInternal(EntitySimulation* simulation, EntityActionPoi
_allActionsDataCache = newDataCache; _allActionsDataCache = newDataCache;
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION; _dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
} else { } else {
qDebug() << "EntityItem::addActionInternal -- serializeActions failed"; qCDebug(entities) << "EntityItem::addActionInternal -- serializeActions failed";
} }
return success; return success;
} }
@ -1706,7 +1707,7 @@ bool EntityItem::updateAction(EntitySimulation* simulation, const QUuid& actionI
serializeActions(success, _allActionsDataCache); serializeActions(success, _allActionsDataCache);
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION; _dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
} else { } else {
qDebug() << "EntityItem::updateAction failed"; qCDebug(entities) << "EntityItem::updateAction failed";
} }
}); });
return success; return success;
@ -1777,7 +1778,7 @@ void EntityItem::deserializeActionsInternal() {
quint64 now = usecTimestampNow(); quint64 now = usecTimestampNow();
if (!_element) { if (!_element) {
qDebug() << "EntityItem::deserializeActionsInternal -- no _element"; qCDebug(entities) << "EntityItem::deserializeActionsInternal -- no _element";
return; return;
} }
@ -1805,14 +1806,13 @@ void EntityItem::deserializeActionsInternal() {
continue; continue;
} }
updated << actionID;
if (_objectActions.contains(actionID)) { if (_objectActions.contains(actionID)) {
EntityActionPointer action = _objectActions[actionID]; EntityActionPointer action = _objectActions[actionID];
// TODO: make sure types match? there isn't currently a way to // TODO: make sure types match? there isn't currently a way to
// change the type of an existing action. // change the type of an existing action.
action->deserialize(serializedAction); action->deserialize(serializedAction);
action->locallyAddedButNotYetReceived = false; action->locallyAddedButNotYetReceived = false;
updated << actionID;
} else { } else {
auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>(); auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
EntityItemPointer entity = getThisPointer(); EntityItemPointer entity = getThisPointer();
@ -1820,8 +1820,13 @@ void EntityItem::deserializeActionsInternal() {
if (action) { if (action) {
entity->addActionInternal(simulation, action); entity->addActionInternal(simulation, action);
action->locallyAddedButNotYetReceived = false; action->locallyAddedButNotYetReceived = false;
updated << actionID;
} else { } else {
qDebug() << "EntityItem::deserializeActionsInternal -- action creation failed"; static QString repeatedMessage =
LogHandler::getInstance().addRepeatedMessageRegex(".*action creation failed for.*");
qCDebug(entities) << "EntityItem::deserializeActionsInternal -- action creation failed for"
<< getID() << getName();
removeActionInternal(actionID, nullptr);
} }
} }
} }
@ -1897,7 +1902,8 @@ void EntityItem::serializeActions(bool& success, QByteArray& result) const {
serializedActionsStream << serializedActions; serializedActionsStream << serializedActions;
if (result.size() >= _maxActionsDataSize) { if (result.size() >= _maxActionsDataSize) {
qDebug() << "EntityItem::serializeActions size is too large -- " << result.size() << ">=" << _maxActionsDataSize; qCDebug(entities) << "EntityItem::serializeActions size is too large -- "
<< result.size() << ">=" << _maxActionsDataSize;
success = false; success = false;
return; return;
} }