-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
feat(controller): load contracts asynchronously #544
feat(controller): load contracts asynchronously #544
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is the slowdown from putting all the FCs in the contracts folder.
I assume you noticed this after loading the entire contracts repo for your "offline" (aka piracy) branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Some feedback
@@ -857,6 +861,8 @@ export class Controller { | |||
log(LogLevel.DEBUG, e, "contracts") | |||
} | |||
} | |||
|
|||
log(LogLevel.INFO, "Contracts loading completed", "contracts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be best to do this as a .then
on the Promise that index
returns so that it's more accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't notice that, good point. I'll edit it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't matter, no? In both cases, the log is called after all promises are awaited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other promises are blocked on their awaits, but just because they are guaranteed to be done before the first one doesn't mean the first one will be.
Well, wanting to play offline doesn't mean I'm doing anything nefarious. Assuming such things imo isn't a great way to start a conversation. But if you really think it could be used for such a purpose, I'd be ok to remove the branch. |
What do you mean? You return a list of all entitlements no matter what the user owns. That is textbook piracy. EDIT: I understand the motivation, but this is not the way to do this. |
Or a hardcoded list of entitlements I own. Tbh it's a quick hack and not a proper way of doing things. But I see where you're coming from.
I've taken the branch down now |
It's much appreciated, the proper way to do it would be making the user connect online first to grab their entitlements. Then using the stored versions in userdata when offline. |
Scope
this PR adds a small change so that locally saved contracts (in ./contracts/) don't block the server start.
the server will start immediately, and continue to load contracts in the background.
Test Plan
connecting to the server should work quickly, even with a lot of contracts in the local folder.
Checklist