mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-05 05:22:07 +08:00
Fix RequestRepeater caching (#21693)
* Fix RequestRepeater caching * cleanup Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: ca51b3865fa360a7a9b69a0748ee92033ac9520c
This commit is contained in:
@@ -15,7 +15,7 @@ RequestRepeater::RequestRepeater(QObject *parent, const QString &requestURL, con
|
||||
if (!cacheKey.isEmpty()) {
|
||||
prevResp = QString::fromStdString(params.get(cacheKey.toStdString()));
|
||||
if (!prevResp.isEmpty()) {
|
||||
QTimer::singleShot(0, [=]() { emit receivedResponse(prevResp); });
|
||||
QTimer::singleShot(500, [=]() { emit receivedResponse(prevResp); });
|
||||
}
|
||||
QObject::connect(this, &HttpRequest::receivedResponse, [=](const QString &resp) {
|
||||
if (resp != prevResp) {
|
||||
@@ -23,11 +23,5 @@ RequestRepeater::RequestRepeater(QObject *parent, const QString &requestURL, con
|
||||
prevResp = resp;
|
||||
}
|
||||
});
|
||||
QObject::connect(this, &HttpRequest::failedResponse, [=](const QString &err) {
|
||||
if (!prevResp.isEmpty()) {
|
||||
params.remove(cacheKey.toStdString());
|
||||
prevResp = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user