Skip to content

Move the start of the server to only run when the microservice runs #73

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lagartoverde
Copy link

@lagartoverde lagartoverde commented Apr 11, 2025

Description

This PR removes the server start from importing from mu and moves it, so it only runs when the microservice is started

Motivation

Until now whenever you imported from the mu library you started a server, which was fine for simpler microservices, where everything is imported on app.js, but as the microservices get more complex we need to do some imports without the server starting, for example in order to do unit tests of functions using the sparql helpers.
Also imho it's conceptually wrong that a import has a side effect.

Testing

Check that everything works as before, and the PR doesn't break a microservice in anyway. Now you should be able to import from mu without starting any server

@madnificent
Copy link
Member

Discussed this with @lagartoverde over chat. We want to structurally support unit tests in the future but will first take the route of the integration tests which is also ongoing. In the meantime this PR allows to do some hacks in the server which don't boot up the server directly.

The server booting up when mu' gets imported is not intentional behaviour and I don't think anything depends on it, nor should it. Splitting up launching the server from importing mu' should not break anything.

It makes sense to land this in the same release as the rewired setup because any potential bugs or resulting behavioural changes may as well get detected and tackled by consumers in one go.

@lagartoverde lagartoverde changed the title POC: moved the start of the server to only run when the microservice runs Move the start of the server to only run when the microservice runs Apr 17, 2025
no functional change
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.

2 participants