fix: no more fetch when it is already fetching
This commit is contained in:
parent
455719befa
commit
596764479f
|
@ -672,12 +672,15 @@ void ctgTestRspUdfInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pR
|
||||||
SRetrieveFuncRsp funcRsp = {0};
|
SRetrieveFuncRsp funcRsp = {0};
|
||||||
funcRsp.numOfFuncs = 1;
|
funcRsp.numOfFuncs = 1;
|
||||||
funcRsp.pFuncInfos = taosArrayInit(1, sizeof(SFuncInfo));
|
funcRsp.pFuncInfos = taosArrayInit(1, sizeof(SFuncInfo));
|
||||||
|
funcRsp.pFuncVersions = taosArrayInit(1, sizeof(int32_t));
|
||||||
SFuncInfo funcInfo = {0};
|
SFuncInfo funcInfo = {0};
|
||||||
strcpy(funcInfo.name, "func1");
|
strcpy(funcInfo.name, "func1");
|
||||||
funcInfo.funcType = ctgTestFuncType;
|
funcInfo.funcType = ctgTestFuncType;
|
||||||
|
|
||||||
(void)taosArrayPush(funcRsp.pFuncInfos, &funcInfo);
|
(void)taosArrayPush(funcRsp.pFuncInfos, &funcInfo);
|
||||||
|
int32_t version = 0;
|
||||||
|
(void)taosArrayPush(funcRsp.pFuncVersions, &version);
|
||||||
|
|
||||||
int32_t rspLen = tSerializeSRetrieveFuncRsp(NULL, 0, &funcRsp);
|
int32_t rspLen = tSerializeSRetrieveFuncRsp(NULL, 0, &funcRsp);
|
||||||
void *pReq = rpcMallocCont(rspLen);
|
void *pReq = rpcMallocCont(rspLen);
|
||||||
tSerializeSRetrieveFuncRsp(pReq, rspLen, &funcRsp);
|
tSerializeSRetrieveFuncRsp(pReq, rspLen, &funcRsp);
|
||||||
|
|
|
@ -581,6 +581,7 @@ int32_t udfdInitUdf(char *udfName, SUdf *udf) {
|
||||||
SUdf *udfdNewUdf(const char *udfName) {
|
SUdf *udfdNewUdf(const char *udfName) {
|
||||||
SUdf *udfNew = taosMemoryCalloc(1, sizeof(SUdf));
|
SUdf *udfNew = taosMemoryCalloc(1, sizeof(SUdf));
|
||||||
udfNew->refCount = 1;
|
udfNew->refCount = 1;
|
||||||
|
udfNew->lastFetchTime = taosGetTimestampUs();
|
||||||
strncpy(udfNew->name, udfName, TSDB_FUNC_NAME_LEN);
|
strncpy(udfNew->name, udfName, TSDB_FUNC_NAME_LEN);
|
||||||
|
|
||||||
udfNew->state = UDF_STATE_INIT;
|
udfNew->state = UDF_STATE_INIT;
|
||||||
|
@ -618,6 +619,7 @@ SUdf *udfdGetOrCreateUdf(const char *udfName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SUdf *udf = udfdNewUdf(udfName);
|
SUdf *udf = udfdNewUdf(udfName);
|
||||||
|
|
||||||
SUdf **pUdf = &udf;
|
SUdf **pUdf = &udf;
|
||||||
taosHashPut(global.udfsHash, udfName, strlen(udfName), pUdf, POINTER_BYTES);
|
taosHashPut(global.udfsHash, udfName, strlen(udfName), pUdf, POINTER_BYTES);
|
||||||
uv_mutex_unlock(&global.udfsMutex);
|
uv_mutex_unlock(&global.udfsMutex);
|
||||||
|
@ -902,8 +904,8 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
||||||
udf->version = *(int32_t *)taosArrayGet(retrieveRsp.pFuncVersions, 0);
|
udf->version = *(int32_t *)taosArrayGet(retrieveRsp.pFuncVersions, 0);
|
||||||
|
|
||||||
msgInfo->code = udfdSaveFuncBodyToFile(pFuncInfo, udf);
|
msgInfo->code = udfdSaveFuncBodyToFile(pFuncInfo, udf);
|
||||||
if (msgInfo->code == 0) {
|
if (msgInfo->code != 0) {
|
||||||
udf->lastFetchTime = taosGetTimestampUs();
|
udf->lastFetchTime = 0;
|
||||||
}
|
}
|
||||||
tFreeSFuncInfo(pFuncInfo);
|
tFreeSFuncInfo(pFuncInfo);
|
||||||
taosArrayDestroy(retrieveRsp.pFuncInfos);
|
taosArrayDestroy(retrieveRsp.pFuncInfos);
|
||||||
|
|
Loading…
Reference in New Issue