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

Publish "Tenants.changed!" when new tenants are loaded #618

Merged
merged 4 commits into from
Oct 8, 2024

Conversation

byewokko
Copy link
Collaborator

@byewokko byewokko commented Oct 7, 2024

  • When asab.web.tenant.TenantService loads new tenants different from the previous state, a pubsub message "Tenants.changed!" is published.
  • asab.web.tenant.TenantService now loads all tenants (including the ones from config) in the asynchronous initialization stage. This is to prevent multiple pubsub messages on app startup.

@byewokko byewokko added the enhancement New feature or request label Oct 7, 2024
@byewokko byewokko self-assigned this Oct 7, 2024
new_tenants.update(self._StaticTenants)

if self.Tenants != new_tenants:
self.App.PubSub.publish("Tenants.changed!")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "Tenants.change!", same as "Library.change!"?

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 think "changed" is more accurate (or less ambiguous).

but true, let's stay consistent. i will rename it.

@language-shprt language-shprt self-requested a review October 8, 2024 11:39
@byewokko byewokko merged commit 6f4bf6c into master Oct 8, 2024
8 checks passed
@byewokko byewokko deleted the feature/pubsub-on-tenant-change branch October 8, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants