Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Add restart core. Closes #1548#1549

Merged
juliangruber merged 4 commits intomainfrom
add/restart-core
May 28, 2024
Merged

Add restart core. Closes #1548#1549
juliangruber merged 4 commits intomainfrom
add/restart-core

Conversation

@juliangruber
Copy link
Member

Closes #1548

@juliangruber juliangruber requested a review from bajtos May 22, 2024 10:02
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

This looks like a disruptive change to me. Did you check that the caller of setup can handle the case when setup never returns?

IIRC:

  • now: setup returns immediately after starting Station Core process, the process runs in the background
  • your change: setup waits for the process to complete

If we decide this is the direction to go, then I think we should rename start to something like run or runOnce, considering that the function no longer starts the process in the background but instead waits until the process exits.

@juliangruber
Copy link
Member Author

This looks like a disruptive change to me. Did you check that the caller of setup can handle the case when setup never returns?

IIRC:

  • now: setup returns immediately after starting Station Core process, the process runs in the background
  • your change: setup waits for the process to complete

If we decide this is the direction to go, then I think we should rename start to something like run or runOnce, considering that the function no longer starts the process in the background but instead waits until the process exits.

Yes, core.setup() is the last call performed by run() in main/index.js. We could change its name as to not break consistency with the other functions called setup(), what do you think about start()? run() also works. runOnce doesn't work, as the function restarts Core inside its body.

@juliangruber
Copy link
Member Author

This looks like a disruptive change to me.

Are you saying we should find a different way to restart it?

@bajtos
Copy link
Member

bajtos commented May 23, 2024

Yes, core.setup() is the last call performed by run() in main/index.js. We could change its name as to not break consistency with the other functions called setup(), what do you think about start()? run() also works. runOnce doesn't work, as the function restarts Core inside its body.

Thank you for checking!

Based on what you wrote, I think it will be best to rename setup to run.

This looks like a disruptive change to me.

Are you saying we should find a different way to restart it?

I'd like to be careful and make sure we understand the ramifications of this change.

It looks "easy" and innocent at first sight, but changes the behaviour in subtle ways that can easily introduce bugs - at least, that's what I remember from how we were iterating on lib/zinnia.js in Station Core.

@juliangruber
Copy link
Member Author

Yes, core.setup() is the last call performed by run() in main/index.js. We could change its name as to not break consistency with the other functions called setup(), what do you think about start()? run() also works. runOnce doesn't work, as the function restarts Core inside its body.

Thank you for checking!

Based on what you wrote, I think it will be best to rename setup to run.

I added run in addition to setup, so that run doesn't modify ctx, which typically only the setup methods do.

This looks like a disruptive change to me.

Are you saying we should find a different way to restart it?

I'd like to be careful and make sure we understand the ramifications of this change.

It looks "easy" and innocent at first sight, but changes the behaviour in subtle ways that can easily introduce bugs - at least, that's what I remember from how we were iterating on lib/zinnia.js in Station Core.

I agree, that migration was quite tricky!

@juliangruber juliangruber requested a review from bajtos May 23, 2024 12:17
@juliangruber juliangruber requested a review from bajtos May 24, 2024 12:05
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

👌🏻

@juliangruber juliangruber merged commit 7d5975d into main May 28, 2024
@juliangruber juliangruber deleted the add/restart-core branch May 28, 2024 08:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically restart Station Core

2 participants