fix
This commit is contained in:
parent
432c45067d
commit
e9ed1963ea
@ -73,6 +73,7 @@ async function processBlock(blockNum, sendQueueRepository: Repository<SendQueue>
|
||||
payload.os = t2a.os === "android" ? "android" : "ios"; // hacky
|
||||
payload.token = t2a.token;
|
||||
payload.type = 2;
|
||||
payload.badge = 1;
|
||||
await sendQueueRepository.save({
|
||||
data: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
@ -30,9 +30,9 @@ process
|
||||
let sendQueueRepository: Repository<SendQueue>;
|
||||
|
||||
async function processMempool() {
|
||||
console.log("cached txids=", Object.keys(processedTxids).length);
|
||||
process.env.VERBOSE && console.log("cached txids=", Object.keys(processedTxids).length);
|
||||
const responseGetrawmempool = await client.request("getrawmempool", []);
|
||||
console.log(responseGetrawmempool.result.length, "txs in mempool");
|
||||
process.env.VERBOSE && console.log(responseGetrawmempool.result.length, "txs in mempool");
|
||||
|
||||
let addresses: string[] = [];
|
||||
let allPotentialPushPayloadsArray: Components.Schemas.PushNotificationOnchainAddressGotUnconfirmedTransaction[] = [];
|
||||
@ -94,6 +94,7 @@ async function processMempool() {
|
||||
payload.os = t2a.os === "android" ? "android" : "ios"; // hacky
|
||||
payload.token = t2a.token;
|
||||
payload.type = 3;
|
||||
payload.badge = 1;
|
||||
await sendQueueRepository.save({
|
||||
data: JSON.stringify(payload),
|
||||
});
|
||||
@ -107,7 +108,7 @@ async function processMempool() {
|
||||
|
||||
const endBatch = +new Date();
|
||||
// process.stdout.write('.');
|
||||
console.log("batch took", (endBatch - startBatch) / 1000, "sec");
|
||||
process.env.VERBOSE && console.log("batch took", (endBatch - startBatch) / 1000, "sec");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -144,8 +145,9 @@ createConnection({
|
||||
console.log(error);
|
||||
}
|
||||
const end = +new Date();
|
||||
console.log("processing mempool took", (end - start) / 1000, "sec");
|
||||
console.log("-----------------------");
|
||||
process.env.VERBOSE && console.log("processing mempool took", (end - start) / 1000, "sec");
|
||||
process.env.VERBOSE && console.log("-----------------------");
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
|
||||
@ -53,6 +53,8 @@ createConnection({
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||
continue;
|
||||
}
|
||||
// TODO: we could atomically lock this record via mariadb's GET_LOCK and typeorm's raw query, and that would
|
||||
// allow us to run multiple sender workers in parallel
|
||||
let payload;
|
||||
try {
|
||||
payload = JSON.parse(record.data);
|
||||
@ -62,14 +64,12 @@ createConnection({
|
||||
case 2:
|
||||
payload = <Components.Schemas.PushNotificationOnchainAddressGotPaid>payload;
|
||||
console.warn("pushing to token", payload.token, payload.os);
|
||||
payload.badge = 1;
|
||||
await GroundControlToMajorTom.pushOnchainAddressWasPaid(serverKey, apnsPem, payload);
|
||||
await sendQueueRepository.remove(record);
|
||||
break;
|
||||
case 3:
|
||||
payload = <Components.Schemas.PushNotificationOnchainAddressGotUnconfirmedTransaction>payload;
|
||||
console.warn("pushing to token", payload.token, payload.os);
|
||||
payload.badge = 1;
|
||||
await GroundControlToMajorTom.pushOnchainAddressGotUnconfirmedTransaction(serverKey, apnsPem, payload);
|
||||
await sendQueueRepository.remove(record);
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user