-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement redis queue #15
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems very interesting!
|
||
const connection = await agent.connections.findById(message.connectionId) | ||
let connection: ConnectionRecord | null = null | ||
connection = await this.checkForDuplicateId(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this method should return undefined, throwing an Error in case of duplicate like it does right now), and the line const connection = await agent.connections.findById(message.connectionId)
remain here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
private readonly coreMessageService: CoreMessageService, | ||
) {} | ||
|
||
async setProcessMessage(redisAvailable: boolean, message: IBaseMessage, connection: ConnectionRecord) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't call this simply processMessage
, receiving the message and connection and doing the isRedisAvailable check right here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
async setProcessMessage(redisAvailable: boolean, message: IBaseMessage, connection: ConnectionRecord) { | ||
return redisAvailable | ||
? await this.messageQueue.add('', { message, connection }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does that '' mean? Seems a bit awkward to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its a conditional ternary operator. It's used to simplify the "if" condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking about await this.messageQueue.add('', { message, connection })
. The first argument is an empty string. What does it mean? Is it the right way of doing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's not necessary
README.md
Outdated
@@ -34,6 +34,8 @@ but likely needed for production and test deployments. | |||
| POSTGRES_PASSWORD | PosgreSQL database password | None | | |||
| POSTGRES_ADMIN_USER | PosgreSQL database admin user | None | | |||
| POSTGRES_ADMIN_PASSWORD | PosgreSQL database admin password | None | | |||
| REDIS_HOST | Redis database host user | None | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments regarding the usage of this Redis (what does it does) and the fact that is optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
No description provided.