Use real UUIDs for pendingCoroutines

This commit is contained in:
miruka 2019-12-04 06:22:04 -04:00
parent 26e63e4ab2
commit 87a81ed1a7
3 changed files with 9 additions and 3 deletions

View File

@ -15,7 +15,7 @@ Python {
}
function callCoro(name, args=[], onSuccess=null, onError=null) {
let uuid = Math.random() + "." + name
let uuid = name + "." + CppUtils.uuid()
pendingCoroutines[uuid] = {onSuccess, onError}
call("APP.call_backend_coro", [name, uuid, args])
@ -25,7 +25,7 @@ Python {
accountId, name, args=[], onSuccess=null, onError=null
) {
callCoro("wait_until_client_exists", [accountId], () => {
let uuid = Math.random() + "." + name
let uuid = accountId + "." + name + "." + CppUtils.uuid()
pendingCoroutines[uuid] = {onSuccess, onError}
call("APP.call_client_coro", [accountId, name, uuid, args])

View File

@ -1,5 +1,5 @@
#include <QLocale>
#include <QDebug>
#include <QUuid>
#include "utils.h"
@ -14,3 +14,8 @@ QString Utils::formattedBytes(qint64 bytes, int precision) {
bytes, precision, QLocale::DataSizeTraditionalFormat
);
};
QString Utils::uuid() {
return QUuid::createUuid().toString(QUuid::WithoutBraces);
}

View File

@ -14,6 +14,7 @@ public:
public slots:
QString formattedBytes(qint64 bytes, int precision = 2);
QString uuid();
private:
QLocale m_locale;