Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/core/streamr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@ export default class implements Hooks {
});

try {
console.log(`[streamr] Connecting to ${STREAMR_STREAM_ID}...`);
const stream = await retry(() => streamrClient.getStream(STREAMR_STREAM_ID!), 3, 2000);

await new Promise((resolve) => setTimeout(resolve, 2000));

console.log(`[streamr] Connected. Publishing ${pendingTransactions.length} transactions...`);
const batchPayload = buildBatchPayload(pendingTransactions);
await stream.publish(batchPayload);

console.log(`[streamr] Published ${pendingTransactions.length} transactions to stream ${STREAMR_STREAM_ID}`);
await new Promise((resolve) => setTimeout(resolve, 2000));
} catch (error) {
console.error(`Failed to publish to Streamr: ${(error as Error).message}`);
throw error;
console.error(`[streamr] Error publishing to Streamr:`, error);
} finally {
// destroy the client to free resources
await streamrClient.destroy();
Expand Down
3 changes: 3 additions & 0 deletions src/lib/core/streamr/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export default class implements UIHooks {
const batchPayload = buildBatchPayload(pendingTransactions);
await new Promise((resolve) => setTimeout(resolve, 2000));
await stream.publish(batchPayload);
console.log(`[streamr-ui] Published ${pendingTransactions.length} transactions to stream ${streamId}`);
} catch (error) {
console.error(`[streamr-ui] Error publishing to Streamr:`, error);
} finally {
await streamrClient.destroy();
}
Expand Down