add more log
This commit is contained in:
parent
76ade60994
commit
244cfe217c
|
@ -323,6 +323,7 @@ TAOS_SUB *taos_subscribe(TAOS *taos, int restart, const char* topic, const char
|
||||||
|
|
||||||
pSub->interval = interval;
|
pSub->interval = interval;
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
|
tscTrace("asynchronize subscription, create new timer", topic);
|
||||||
pSub->fp = fp;
|
pSub->fp = fp;
|
||||||
pSub->param = param;
|
pSub->param = param;
|
||||||
taosTmrReset(tscProcessSubscriptionTimer, interval, pSub, tscTmr, &pSub->pTimer);
|
taosTmrReset(tscProcessSubscriptionTimer, interval, pSub, tscTmr, &pSub->pTimer);
|
||||||
|
@ -343,17 +344,20 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
|
||||||
if (pSub->pTimer == NULL) {
|
if (pSub->pTimer == NULL) {
|
||||||
int duration = (int)(taosGetTimestampMs() - pSub->lastConsumeTime);
|
int duration = (int)(taosGetTimestampMs() - pSub->lastConsumeTime);
|
||||||
if (duration < pSub->interval) {
|
if (duration < pSub->interval) {
|
||||||
|
tscTrace("subscription consume too frequently, blocking...");
|
||||||
taosMsleep(pSub->interval - (int32_t)duration);
|
taosMsleep(pSub->interval - (int32_t)duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosGetTimestampMs() - pSub->lastSyncTime > 10 * 60 * 1000) {
|
if (taosGetTimestampMs() - pSub->lastSyncTime > 10 * 60 * 1000) {
|
||||||
|
tscTrace("begin meter synchronization");
|
||||||
char* sqlstr = pSql->sqlstr;
|
char* sqlstr = pSql->sqlstr;
|
||||||
pSql->sqlstr = NULL;
|
pSql->sqlstr = NULL;
|
||||||
taos_free_result_imp(pSql, 0);
|
taos_free_result_imp(pSql, 0);
|
||||||
pSql->sqlstr = sqlstr;
|
pSql->sqlstr = sqlstr;
|
||||||
taosClearDataCache(tscCacheHandle);
|
taosClearDataCache(tscCacheHandle);
|
||||||
if (!tscUpdateSubscription(pSub->taos, pSub)) return NULL;
|
if (!tscUpdateSubscription(pSub->taos, pSub)) return NULL;
|
||||||
|
tscTrace("meter synchronization completed");
|
||||||
} else {
|
} else {
|
||||||
uint16_t type = pSql->cmd.type;
|
uint16_t type = pSql->cmd.type;
|
||||||
taos_free_result_imp(pSql, 1);
|
taos_free_result_imp(pSql, 1);
|
||||||
|
@ -365,9 +369,9 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
|
||||||
pSql->cmd.type = type;
|
pSql->cmd.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tscDoQuery(pSql);
|
tscDoQuery(pSql);
|
||||||
if (pRes->code != TSDB_CODE_SUCCESS) {
|
if (pRes->code != TSDB_CODE_SUCCESS) {
|
||||||
|
tscError("failed to query data, error code=%d", pRes->code);
|
||||||
tscRemoveFromSqlList(pSql);
|
tscRemoveFromSqlList(pSql);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue