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

Library: GitProvider - Don't stop the app even if the library is not ready #639

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions asab/library/providers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def init_task():
)
else:
L.exception("Error when initializing git repository: {}".format(pygit_message))
self.App.stop() # NOTE: raising Exception doesn't exit the app

except pygit2.GitError as err:
pygit_message = str(err).replace('\"', '')
Expand Down Expand Up @@ -172,7 +171,6 @@ def init_task():
)
else:
L.exception("Git repository not initialized: {}".format(err))
self.App.stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

return ... don't claim "library ready" - as discussed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added returns. But I tested it in the remote control. And remote control works even if the library is not ready. asab.library module does not restrict you to read from the library when library is not ready. So it is up to each microservice to check whether the library is ready before reading. Moreover, in remote control, I subscribe to changes in the Library on library ready. But the Library.ready! signal never comes. So, the remote control is running with wrong set of library layers and without the update of model. Which is serious.

I think we need to decide whether this should be solved on the asab level or on the microservice level and adjust first. Only then, this can be merged.

	async def _on_library_ready(self, event_name, library=None):
		# subscribe to /Site - that's wehere the model files are
		await self.App.LibraryService.subscribe(self.MODEL_PATH)
		self.App.TaskService.schedule(self.update_model_cache())


except Exception as err:
L.exception(err)
Expand Down
Loading