Skip to content

[app_dart] Create scheduler service#1087

Merged
CaseyHillers merged 4 commits intoflutter:masterfrom
CaseyHillers:commit_webhooks
Feb 18, 2021
Merged

[app_dart] Create scheduler service#1087
CaseyHillers merged 4 commits intoflutter:masterfrom
CaseyHillers:commit_webhooks

Conversation

@CaseyHillers
Copy link
Contributor

Refactors logic in refresh_github_commits into a service

Issues

flutter/flutter#76140

Future work

  • Trigger adding tasks from github webhooks
    • Remove the cron method
  • Move retry logic into this service

Comment on lines +79 to +80
// Ensure commits are sorted from newest to oldest
commits.sort((Commit a, Commit b) => a.timestamp.compareTo(b.timestamp));
Copy link
Contributor

Choose a reason for hiding this comment

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

list is already sorted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is mostly for tests. I removed documentation. In the next PR, I want to switch this from a list to a single commit and will be irrelevant.


// Save [Commit] to BigQuery and create [Task] in Datastore.
await _saveData(newCommits, datastore);
final List<Commit> recentCommits = await _getRecentCommits(commits, datastore, branch);
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this logic to scheduler as well to save both time and space (processing RepositoryCommit directly)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left this code here as in the follow up PR I want to remove it completely (move to a single commit from a webhook). SG?

Copy link
Contributor

@keyonghan keyonghan 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
Contributor

@godofredoc godofredoc left a comment

Choose a reason for hiding this comment

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

Given that this is new functionality should it be implemented as a separate service detached from cocoon? ideally this should be a microservice with a well defined api, implementing and then migrating later is more complicated because we need to consider backward compatibility, etc.

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