consolidate more into outbound queue
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 30s Details

This commit is contained in:
Ladd Hoffman 2024-04-27 13:49:27 -05:00
parent de4ce0da5e
commit c497b55294
3 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,6 @@
const { proposals } = require('../util/contracts');
const read = require('../api/read');
const { sendNewProposalEvent } = require('../matrix-bot');
const { sendNewProposalEvent } = require('../matrix-bot/outbound-queue');
// Subscribe to proposal events
const start = () => {
@ -19,6 +19,8 @@ const start = () => {
if (post.embeddedData && Object.entries(post.embeddedData).length) {
message += `\n\n${JSON.stringify(post.embeddedData, null, 2)}`;
}
// The outbound queue handles deduplication
sendNewProposalEvent(proposalIndex, message);
});
};

View File

@ -20,7 +20,7 @@ const cryptoProvider = new RustSdkCryptoStorageProvider(BOT_CRYPTO_STORAGE_PATH)
let client;
let joinedRooms;
const { outboundQueue, startOutboundQueue } = require('./outbound-queue');
const { startOutboundQueue } = require('./outbound-queue');
const start = async () => {
console.log('MATRIX_HOMESERVER_URL:', MATRIX_HOMESERVER_URL);
@ -50,11 +50,6 @@ const start = async () => {
});
};
const sendNewProposalEvent = (proposalIndex, text) => {
outboundQueue.push({ type: 'NewProposal', proposalIndex, text });
};
module.exports = {
start,
sendNewProposalEvent,
};

View File

@ -42,8 +42,13 @@ const startOutboundQueue = (c) => {
outboundQueue.resume();
};
const sendNewProposalEvent = (proposalIndex, text) => {
outboundQueue.push({ type: 'NewProposal', proposalIndex, text });
};
module.exports = {
setTargetRoomId,
outboundQueue,
startOutboundQueue,
sendNewProposalEvent,
};