Skip to content

Commit

Permalink
test blank worker
Browse files Browse the repository at this point in the history
  • Loading branch information
dydxwill committed Jun 24, 2024
1 parent 0212d67 commit 24ad8b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions indexer/services/socks/src/lib/message-forwarder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import {
import { Index } from '../websocket/index';
import { MAX_TIMEOUT_INTEGER } from './constants';
import { Subscriptions } from './subscription';
import {
import getMessagesToForward, {
getChannels,
} from './workers/from-kafka-helpers';

const piscina = new Piscina({
filename: path.resolve(__dirname, 'workers/from-kafka-helpers.js'),
minThreads: 4,
maxThreads: 4,
filename: path.resolve(__dirname, 'workers/blank-worker.js'),
minThreads: 1,
maxThreads: 2,
});

const BATCH_SEND_INTERVAL_MS: number = config.BATCH_SEND_INTERVAL_MS;
Expand Down Expand Up @@ -124,10 +124,10 @@ export class MessageForwarder {
errProps.channels = channels;

// Decode the message based on the topic
// const messagesToForward = getMessagesToForward(topic, message);
const clobPairIdToTickerMap:
Record<string, string> = perpetualMarketRefresher.getClobPairIdToTickerMap();
const messagesToForward = await piscina.run({ topic, message, clobPairIdToTickerMap });
const messagesToForward = getMessagesToForward({ topic, message, clobPairIdToTickerMap });
await piscina.run({});
for (const messageToForward of messagesToForward) {
const startForwardMessage: number = Date.now();
this.forwardMessage(messageToForward);
Expand Down
8 changes: 8 additions & 0 deletions indexer/services/socks/src/lib/workers/blank-worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {logger} from '@dydxprotocol-indexer/base';

export default function print(): void {
logger.info({
at: 'blank-worker#print',
message: 'Hello, World!',
});
}

0 comments on commit 24ad8b8

Please sign in to comment.