未验证 提交 7aa8cee6 编写于 作者: dengyihao's avatar dengyihao 提交者: GitHub

Merge pull request #12001 from taosdata/feature/refator_retry

refactor(rpc): refactor timeout
......@@ -68,7 +68,7 @@ extern "C" {
*/
void iIntersection(SArray *interResults, SArray *finalResult);
/* multi sorted result intersection
/* multi sorted result union
* input: [1, 2, 4, 5]
* [2, 3, 4, 5]
* [1, 4, 5]
......@@ -76,7 +76,7 @@ void iIntersection(SArray *interResults, SArray *finalResult);
*/
void iUnion(SArray *interResults, SArray *finalResult);
/* sorted array
/* see example
* total: [1, 2, 4, 5, 7, 8]
* except: [4, 5]
* return: [1, 2, 7, 8] saved in total
......
......@@ -891,7 +891,6 @@ static void doDelayTask(void* param) {
SCliMsg* pMsg = arg->param1;
SCliThrdObj* pThrd = arg->param2;
cliHandleReq(pMsg, pThrd);
taosMemoryFree(arg);
......
......@@ -425,10 +425,19 @@ void transDQDestroy(SDelayQueue* queue) {
}
int transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg, uint64_t timeoutMs) {
uint64_t now = taosGetTimestampMs();
SDelayTask* task = taosMemoryCalloc(1, sizeof(SDelayTask));
task->func = func;
task->arg = arg;
task->execTime = taosGetTimestampMs() + timeoutMs;
task->execTime = now + timeoutMs;
HeapNode* minNode = heapMin(queue->heap);
if (minNode) {
SDelayTask* minTask = container_of(minNode, SDelayTask, node);
if (minTask->execTime < task->execTime) {
timeoutMs = minTask->execTime <= now ? 0 : now - minTask->execTime;
}
}
tTrace("timer %p put task into queue, timeoutMs: %" PRIu64 "", queue->timer, timeoutMs);
heapInsert(queue->heap, &task->node);
......
......@@ -810,12 +810,14 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
for (int i = 0; i < srv->numOfThreads; i++) {
SWorkThrdObj* thrd = (SWorkThrdObj*)taosMemoryCalloc(1, sizeof(SWorkThrdObj));
thrd->pTransInst = shandle;
thrd->quit = false;
srv->pThreadObj[i] = thrd;
thrd->pTransInst = shandle;
srv->pipe[i] = (uv_pipe_t*)taosMemoryCalloc(2, sizeof(uv_pipe_t));
uv_os_sock_t fds[2];
if (uv_socketpair(SOCK_STREAM, 0, fds, UV_NONBLOCK_PIPE, UV_NONBLOCK_PIPE) != 0) {
goto End;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册