This commit is contained in:
aozhiwei 2022-12-17 15:24:46 +08:00
parent dec7ea7a3a
commit 6ca822b2c7
3 changed files with 27 additions and 29 deletions

View File

@ -12,7 +12,6 @@
#include <a8/mysql.h>
#include <a8/list.h>
#include <a8/timer.h>
#include <a8/timer_attacher.h>
#include <f8/udplog.h>
#include <a8/mutable_xobject.h>
@ -20,6 +19,7 @@
#include <f8/dbpool.h>
#include <f8/msgqueue.h>
#include <f8/utils.h>
#include <f8/timer.h>
namespace f8
{
@ -46,7 +46,7 @@ namespace f8
time_t add_time = 0;
AsyncDBOnOkFunc on_ok = nullptr;
AsyncDBOnErrorFunc on_error = nullptr;
a8::TimerAttacher timer_attacher;
f8::Attacher timer_attacher;
};
struct AsyncQueryNode
@ -449,24 +449,24 @@ namespace f8
conn_info.DeepCopy(node->conn_info);
db_thread->AddAsyncQuery(node);
}
a8::Timer::Instance()->AddDeadLineTimerAndAttach
int msgid = exec_async_query_msgid;
f8::Timer::Instance()->SetTimeoutEx
(1000 * 10,
a8::XParams()
.SetSender(p->context_id)
.SetParam1(exec_async_query_msgid),
[] (const a8::XParams& param)
[p, msgid] (int event, const a8::Args* args)
{
MsgQueue::Instance()->PostMsg
(param.param1.GetInt(),
a8::Args
(
{
param.sender.GetInt(),
AQE_CONN_ERROR
}
));
if (event == a8::TIMER_EXEC_EVENT) {
MsgQueue::Instance()->PostMsg
(msgid,
a8::Args
(
{
p->context_id,
AQE_CONN_ERROR
}
));
}
},
&p->timer_attacher.timer_list_);
&p->timer_attacher);
++DBPool::Instance()->total_query_num;
}

View File

@ -15,7 +15,6 @@
#include <openssl/err.h>
#include <a8/list.h>
#include <a8/timer.h>
#include <a8/timer_attacher.h>
#include <a8/curl.h>
#include <a8/mutable_xobject.h>
@ -24,6 +23,7 @@
#include <f8/httpclientpool.h>
#include <f8/msgqueue.h>
#include <f8/utils.h>
#include <f8/timer.h>
#define F8_MUTLI_THREAD_HTTP 1
@ -43,7 +43,7 @@ namespace f8
time_t add_time = 0;
AsyncHttpOnOkFunc on_ok = nullptr;
AsyncHttpOnErrorFunc on_error = nullptr;
a8::TimerAttacher timer_attacher;
f8::Attacher timer_attacher;
};
struct AsyncHttpNode
@ -419,15 +419,13 @@ namespace f8
http_thread->AddAsyncHttp(node);
#endif
}
a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10,
a8::XParams()
.SetSender(this)
.SetParam1(p->context_id),
[] (const a8::XParams& param)
{
f8::Timer::Instance()->SetTimeoutEx
(1000 * 10,
[p] (int event, const a8::Args* args)
{
},
&p->timer_attacher.timer_list_);
},
&p->timer_attacher);
}
#if F8_MUTLI_THREAD_HTTP

View File

@ -6,9 +6,9 @@
#include <f8/f8.h>
#include <a8/timer.h>
#include <f8/timer.h>
#include "f8/msgqueue.h"
#include <f8/msgqueue.h>
namespace f8
{