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

Adds cron job handler functions #26

Merged
merged 17 commits into from
Dec 15, 2023
Merged

Conversation

Ajeyakrishna-k
Copy link
Contributor

@Ajeyakrishna-k Ajeyakrishna-k commented Dec 11, 2023

Date: 11 Dec 2023

Developer Name: @Ajeyakrishna-k


Issue Ticket Number:-

Description:

  • Adds a service function to call RDS backend for user id list( users who missed providing progress updates)
  • Adds a service function to call Discord bot to update roles of users
  • Adds a handler function to triggered every 12 hr which fetches all the IDs for users who missed progress updates from rds backend and applies the role to them in discord

Is Under Feature Flag

  • Yes
  • No

Database changes

  • Yes
  • No

Breaking changes (If your feature is breaking/missing something please mention pending tickets)

  • Yes
  • No

Is Development Tested?

  • Yes
  • No

Add relevant Screenshot below ( e.g test coverage etc. )

Screenshot 2023-12-11 at 7 54 22 PM

@Ajeyakrishna-k Ajeyakrishna-k changed the base branch from develop to feat/missed-progress-updates December 11, 2023 13:54
Base automatically changed from feat/missed-progress-updates to develop December 12, 2023 21:36
Copy link
Member

@iamitprakash iamitprakash left a comment

Choose a reason for hiding this comment

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

i don't see working proof here

@Ajeyakrishna-k
Copy link
Contributor Author

Ajeyakrishna-k commented Dec 13, 2023

i don't see working proof here

This is run automatically. We don't get any response or notification.

These are the working proofs for the api it calls:

Screenshot 2023-12-13 at 9 20 41 AM Screenshot 2023-12-13 at 9 12 54 AM

import { DiscordRoleUpdatedList, DiscordUserRole, env } from '../types/global.types';
import { generateDiscordBotJwt } from '../utils/generateJwt';

export const updateUserRoles = async (env: env, payload: DiscordUserRole[]): Promise<DiscordRoleUpdatedList> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this being handled as a part of cron job repo? Don't you think this can be done in RDS backend code itself?
Essentially the cron jobs repo should only contain code that contains the scheduler and the task that is invoked.

Maybe I am missing something here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If a http request takes a long time, server can choose to timeout that request with an error.

  • Currently discord allows us to update roles at an average rate of 1/sec. This means our request can be timed out while the RDS backend is updating a large number of roles at this rate.
  • Since Cloudflare docs mention that it does not have any hard limits on the duration for which cron job can run, I've moved this here.

https://developers.cloudflare.com/workers/platform/limits/

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, but this repo then no longer remains just "cron-jobs". We might have to find a solution for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe create an issue/ RFC that would tackle this?

@iamitprakash iamitprakash merged commit 176690a into develop Dec 15, 2023
1 check passed
@iamitprakash iamitprakash deleted the feat/progress-updates-services branch December 15, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants