Skip to content
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

[messaging] add cronjob for workspaces messages partial sync #3800

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Feb 4, 2024

Context

The current implementation does not automatically fetch new emails which means after the first full-sync we don't have a way to fetch upcoming emails unless we manually run a command. This PR aims to add a new cronJob that will enqueue the necessary jobs to fetch all workspaces connected accounts messages.

Note: CRON is set to run every 10 minutes.

Test

Screenshot 2024-02-04 at 19 22 33

async run(): Promise<void> {
await this.messageQueueService.removeCron(
FetchAllWorkspacesMessagesJob.name,
fetchAllWorkspacesMessagesCronPattern,
Copy link
Member Author

@Weiko Weiko Feb 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bullmq needs the exact same pattern used by addCron when we want to remove a cron, pg-boss does not.

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -77,6 +77,10 @@ export class GmailPartialSyncService {
}

if (newHistoryId === lastSyncHistoryId) {
console.log(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use our logger!

@Weiko Weiko merged commit 0096e60 into main Feb 5, 2024
12 of 13 checks passed
@Weiko Weiko deleted the c--add-cronjob-for-workspaces-messages-partial-fetch branch February 5, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants