fix dye bug

This commit is contained in:
ruanshudong 2020-09-23 10:25:23 +08:00
parent 97f7c22e98
commit 8a7cd8bfed
6 changed files with 152 additions and 153 deletions

View File

@ -681,6 +681,22 @@ bool ServantHandle::processDye(const CurrentPtr &current, string& dyeingKey)
return true;
}
//servant已经被染色, 开启染色日志
if (ServantHelperManager::getInstance()->isDyeing())
{
map<string, string>::const_iterator dyeingKeyIt = current->getRequestStatus().find(ServantProxy::STATUS_GRID_KEY);
if (dyeingKeyIt != current->getRequestStatus().end() &&
ServantHelperManager::getInstance()->isDyeingReq(dyeingKeyIt->second, current->getServantName(), current->getFuncName()))
{
TLOGTARS("[TARS] dyeing servant got a dyeing req, key:" << dyeingKeyIt->second << endl);
dyeingKey = dyeingKeyIt->second;
return true;
}
}
return false;
}

View File

@ -235,9 +235,7 @@ void coroWhenAll(const CoroParallelBasePtr &ptr)
///////////////////////////////////////////////////////////////
string ServantProxy::STATUS_DYED_KEY = "STATUS_DYED_KEY";
//string ServantProxy::STATUS_GRID_KEY = "STATUS_GRID_KEY";
//string ServantProxy::STATUS_SAMPLE_KEY = "STATUS_SAMPLE_KEY";
string ServantProxy::STATUS_GRID_KEY = "STATUS_GRID_KEY";
string ServantProxy::STATUS_RESULT_CODE = "STATUS_RESULT_CODE";
@ -245,13 +243,8 @@ string ServantProxy::STATUS_RESULT_DESC = "STATUS_RESULT_DESC";
string ServantProxy::STATUS_SETNAME_VALUE = "STATUS_SETNAME_VALUE";
//string ServantProxy::TARS_MASTER_KEY = "TARS_MASTER_KEY";
string ServantProxy::STATUS_TRACK_KEY = "STATUS_TRACK_KEY";
// string ServantProxy::STATUS_COOKIE = "STATUS_COOKIE";
////////////////////////////////////
ServantProxy::ServantProxy(Communicator * pCommunicator, ObjectProxy ** ppObjectProxy, size_t iClientThreadNum)
: _communicator(pCommunicator)

View File

@ -415,9 +415,7 @@ public:
*/
static string STATUS_DYED_KEY; //需要染色的用户ID
// static string STATUS_GRID_KEY; //需要灰度的用户ID
// static string STATUS_SAMPLE_KEY; //stat 采样的信息
static string STATUS_GRID_KEY; //需要灰度染色的用户ID
static string STATUS_RESULT_CODE; //处理结果码,tup使用
@ -425,12 +423,8 @@ public:
static string STATUS_SETNAME_VALUE; //set调用
// static string TARS_MASTER_KEY; //透传主调名称信息
static string STATUS_TRACK_KEY; //track信息
// static string STATUS_COOKIE; //cookie信息
/**
*
*

View File

@ -2000,7 +2000,6 @@ string Tars2Cpp::generateHAsync(const OperationPtr& pPtr, const string& cn) cons
}
s << TAB << "std::map<string, string> _mStatus;" << endl;
/*
if (!routekey.empty())
{
ostringstream os;
@ -2009,7 +2008,6 @@ string Tars2Cpp::generateHAsync(const OperationPtr& pPtr, const string& cn) cons
s << TAB << "_mStatus.insert(std::make_pair(ServantProxy::STATUS_GRID_KEY, " << os.str() << "));" << endl;
}
*/
s << TAB << "tars_invoke_async(tars::TARSNORMAL,\"" << pPtr->getId() << "\", _os, context, _mStatus, callback, true);" << endl;
DEL_TAB;
s << TAB << "}" << endl;
@ -2071,7 +2069,6 @@ string Tars2Cpp::generateH(const OperationPtr& pPtr, bool bVirtual, const string
s << TAB << "std::map<string, string> _mStatus;" << endl;
/*
if (!routekey.empty())
{
ostringstream os;
@ -2080,7 +2077,6 @@ string Tars2Cpp::generateH(const OperationPtr& pPtr, bool bVirtual, const string
s << TAB << "_mStatus.insert(std::make_pair(ServantProxy::STATUS_GRID_KEY, " << os.str() << "));" << endl;
}
*/
// s << TAB << "tars_invoke(tars::TARSNORMAL,\"" << pPtr->getId() << "\", _os.getByteBuffer(), context, _mStatus, rep);" << endl;
s << TAB << "shared_ptr<" + _namespace + "::ResponsePacket> rep = tars_invoke(tars::TARSNORMAL,\"" << pPtr->getId() << "\", _os, context, _mStatus);" << endl;

File diff suppressed because it is too large Load Diff

View File

@ -175,7 +175,7 @@ protected:
//单次任务
if (repeatTime == 0 && !fPtr->_cron.isset)
{
fPtr->_func = [task, this]() {
fPtr->_func = [task]() {
(*task)();
task->reset();
};