Skip to content

Commit 6d51f47

Browse files
committed
linting
1 parent 6630176 commit 6d51f47

File tree

4 files changed

+29
-25
lines changed

4 files changed

+29
-25
lines changed

packages/core/lib/queues/AbstractQueueService.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,15 @@ export abstract class AbstractQueueService<
170170
messageId?: string,
171171
) {
172172
const messageTimestamp = message ? this.tryToExtractTimestamp(message) : undefined
173-
const messageProcessingMilliseconds = messageTimestamp ? Date.now() - messageTimestamp.getTime() : undefined
173+
const messageProcessingMilliseconds = messageTimestamp
174+
? Date.now() - messageTimestamp.getTime()
175+
: undefined
174176

175-
// @ts-ignore
176-
const messageType = (message && this.messageTypeField in message) ? message[this.messageTypeField] : undefined
177+
const messageType =
178+
message && this.messageTypeField in message
179+
? // @ts-ignore
180+
message[this.messageTypeField]
181+
: undefined
177182

178183
this.logger.debug(
179184
{

packages/sqs/lib/sqs/AbstractSqsConsumer.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,9 @@ export abstract class AbstractSqsConsumer<
181181

182182
const visibilityTimeout = await this.getQueueVisibilityTimeout()
183183

184-
try {
185-
this.consumers = Array.from({ length: this.concurrentConsumersAmount })
186-
.map((_) => this.createConsumer({ visibilityTimeout }))
187-
} catch (err) {
188-
console.log(err)
189-
console.log(this.consumers)
190-
}
191-
184+
this.consumers = Array.from({ length: this.concurrentConsumersAmount }).map((_) =>
185+
this.createConsumer({ visibilityTimeout }),
186+
)
192187

193188
for (const consumer of this.consumers) {
194189
consumer.on('error', (err) => {
@@ -283,7 +278,7 @@ export abstract class AbstractSqsConsumer<
283278
private stopExistingConsumers(abort?: boolean) {
284279
for (const consumer of this.consumers) {
285280
consumer.stop({
286-
abort
281+
abort,
287282
})
288283
}
289284
}

packages/sqs/test/consumers/SqsPermissionConsumer.spec.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { SINGLETON_CONFIG, registerDependencies } from '../utils/testContext'
2121
import type { Dependencies } from '../utils/testContext'
2222

2323
import { SqsPermissionConsumer } from './SqsPermissionConsumer'
24-
import type { PERMISSIONS_ADD_MESSAGE_TYPE } from "./userConsumerSchemas";
24+
import type { PERMISSIONS_ADD_MESSAGE_TYPE } from './userConsumerSchemas'
2525

2626
describe('SqsPermissionConsumer', () => {
2727
describe('init', () => {
@@ -606,7 +606,7 @@ describe('SqsPermissionConsumer', () => {
606606

607607
beforeEach(async () => {
608608
diContainer = await registerDependencies({
609-
permissionConsumer: asFunction(dependencies => {
609+
permissionConsumer: asFunction((dependencies) => {
610610
return new SqsPermissionConsumer(dependencies, {
611611
creationConfig: {
612612
queue: {
@@ -616,7 +616,7 @@ describe('SqsPermissionConsumer', () => {
616616
concurrentConsumersAmount: 10,
617617
logMessages: true,
618618
})
619-
})
619+
}),
620620
})
621621
sqsClient = diContainer.cradle.sqsClient
622622
publisher = diContainer.cradle.permissionPublisher
@@ -638,16 +638,20 @@ describe('SqsPermissionConsumer', () => {
638638

639639
it('process all messages properly', async () => {
640640
const messagesAmount = 100
641-
const messages: PERMISSIONS_ADD_MESSAGE_TYPE[] = Array.from({ length: messagesAmount }).map((_, i) => ({
642-
id: `${i}`,
643-
messageType: 'add',
644-
timestamp: new Date().toISOString(),
645-
}))
641+
const messages: PERMISSIONS_ADD_MESSAGE_TYPE[] = Array.from({ length: messagesAmount }).map(
642+
(_, i) => ({
643+
id: `${i}`,
644+
messageType: 'add',
645+
timestamp: new Date().toISOString(),
646+
}),
647+
)
646648

647-
await Promise.all(messages.map(async (m) => {
648-
await publisher.publish(m)
649-
await consumer.handlerSpy.waitForMessageWithId(m.id, 'consumed')
650-
}))
649+
await Promise.all(
650+
messages.map(async (m) => {
651+
await publisher.publish(m)
652+
await consumer.handlerSpy.waitForMessageWithId(m.id, 'consumed')
653+
}),
654+
)
651655

652656
// Verifies that each message is executed only once
653657
expect(consumer.addCounter).toBe(messagesAmount)

packages/sqs/test/consumers/SqsPermissionConsumer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class SqsPermissionConsumer extends AbstractSqsConsumer<
115115
}
116116
this.addCounter += context.incrementAmount
117117
this.processedMessagesIds.add(_message.id)
118-
return Promise.resolve({result: 'success'})
118+
return Promise.resolve({ result: 'success' })
119119
},
120120
{
121121
preHandlerBarrier: options.addPreHandlerBarrier,

0 commit comments

Comments
 (0)