Skip to content

Conversation

@VishakhaSainani-Josh
Copy link
Collaborator

  1. Create cronjob for fetching and processing contributions from gh archive dataset available on bigquery scheduled everyday at 1 am IST.
  2. This cron job fetches all the contributions made by the users on the platform on previous day.
  3. Then Process those contributions and save them in the db.
  4. Also remove the handler- FetchUsersLatestContributions made for testing the ProcessFetchContributions service, as this is build as a cronjob.

…a cron job that is scheduled everyday at 1 am IST
…essfetchcontributions service. As this will be a cronjob
…ecessary auth and user service from dependencies
Comment on lines 17 to 26
func (c *CronJob) Execute(ctx context.Context, fn func(context.Context)) func() {
return func() {
slog.Info("cron job started at", "time ", time.Now())
defer func() {
slog.Info("cron job completed")
}()

fn(ctx)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you try below

func (c *CronJob) Execute(ctx context.Context, fn func(context.Context)) {
	slog.Info("cron job started at", "time ", time.Now())
	defer func() {
		slog.Info("cron job completed")
	}()

	fn(ctx)
}

and when using it

	_, err := s.cron.AddFunc("0 1 * * *", func() { d.Execute(context.Background(), d.run) })

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okay

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.

4 participants