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

chore: remove temporal #2403

Merged
merged 3 commits into from
Jun 28, 2024
Merged

chore: remove temporal #2403

merged 3 commits into from
Jun 28, 2024

Conversation

TBonnin
Copy link
Collaborator

@TBonnin TBonnin commented Jun 24, 2024

Also remove any usage of the schedules table (table and data will be remove later)

Issue ticket number and link

https://linear.app/nango/issue/NAN-1222/remove-temporal-from-codebase
https://linear.app/nango/issue/NAN-1091/update-documentation-about-temporal

Checklist before requesting a review (skip if just adding/editing APIs & templates)

  • I added tests, otherwise the reason is:
  • I added observability, otherwise the reason is:
  • I added analytics, otherwise the reason is:

@TBonnin TBonnin force-pushed the tbonnin/remove-temporal branch 3 times, most recently from 717eb5e to 57c544b Compare June 24, 2024 20:32
@TBonnin TBonnin requested review from bodinsamuel and khaliqgant and removed request for bodinsamuel June 24, 2024 20:44
logger.info('[autoidle] starting');

const syncs = await findPausableDemoSyncs();
const syncs = await findDemoSyncs();
Copy link
Collaborator Author

@TBonnin TBonnin Jun 24, 2024

Choose a reason for hiding this comment

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

It is bit more complicated since schedules are not in the same database anymore and we cannot simply join syncs with schedules tables to find out which ones are running. We could limit to only search the syncs updated in the last X days so the size doesn't grow indefinitely over time, assuming this cron runs successfully at least once during this period. Can you think of a better idea? @khaliqgant @bodinsamuel

Copy link
Contributor

Choose a reason for hiding this comment

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

yes make sense, not ideal but will scale for a long time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A long term solution would be to add a pause_after feature into the orchestrator. For now I will keep the cron job

const resSchedule = await orchestrator.deleteSync({ syncId: sync.id, environmentId: sync.environmentId });
const deletedScheduleCount = resSchedule.isErr() ? 1 : 0;
logger.info(`[deleteSyncs] soft deleted ${deletedScheduleCount} schedules`);
metrics.increment(metrics.Types.JOBS_DELETE_SYNCS_DATA_SCHEDULES, deletedScheduleCount);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

forgot this cron job. I will cleanup by hand the schedules that we are currently not deleting

Copy link
Contributor

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

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

I'll let you finish but looks good, and sorry about all the conflicts :|

- 8081:8080
networks:
- nango

Copy link
Contributor

Choose a reason for hiding this comment

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

Feels good

logger.info('[autoidle] starting');

const syncs = await findPausableDemoSyncs();
const syncs = await findDemoSyncs();
Copy link
Contributor

Choose a reason for hiding this comment

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

yes make sense, not ideal but will scale for a long time

@TBonnin TBonnin force-pushed the tbonnin/remove-temporal branch 2 times, most recently from d88076b to 1a08f90 Compare June 27, 2024 20:53
@TBonnin TBonnin marked this pull request as ready for review June 27, 2024 21:02
@TBonnin TBonnin force-pushed the tbonnin/remove-temporal branch 4 times, most recently from 64b2456 to f3a30c9 Compare June 27, 2024 23:31
if (res.isOk()) {
this.runningScripts.set(syncId, { ...scriptObject, cancelled: true });
} else {
if (res.isErr()) {
Copy link
Collaborator Author

@TBonnin TBonnin Jun 28, 2024

Choose a reason for hiding this comment

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

fixing a race condition where the runner script execution could return before the runningScripts was updated, causing the runScript to return a non cancellation error

if (task.abortController.signal.aborted) {
// task was aborted. No need to set it as failed
return;
}
Copy link
Collaborator Author

@TBonnin TBonnin Jun 28, 2024

Choose a reason for hiding this comment

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

We would attempt to set the already cancelled task to failed, which would fail. No need to do that

Copy link
Contributor

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

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

🗿Congrats!
Just a little details in the UI, the frequency column is less readable imo
Screenshot 2024-06-28 at 10 19 21

@TBonnin
Copy link
Collaborator Author

TBonnin commented Jun 28, 2024

🗿Congrats! Just a little details in the UI, the frequency column is less readable imo Screenshot 2024-06-28 at 10 19 21

Is it something you see in prod? This PR isn't intended to make any functional changes

@bodinsamuel
Copy link
Contributor

I'm seeing that locally, it's just a display thing not really critical

Also remove any usage of the schedules table (table and data will be
remove later)
@TBonnin
Copy link
Collaborator Author

TBonnin commented Jun 28, 2024

I'm seeing that locally, it's just a display thing not really critical

what's in your nango.yaml? The UI should use the same value

@TBonnin TBonnin merged commit 63037f2 into master Jun 28, 2024
20 checks passed
@TBonnin TBonnin deleted the tbonnin/remove-temporal branch June 28, 2024 11:47
@bodinsamuel
Copy link
Contributor

what's in your nango.yaml? The UI should use the same value

for example the one displayed as "every1h" is runs: every 1 hour in nango.yaml

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.

None yet

2 participants