-
Notifications
You must be signed in to change notification settings - Fork 23
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
⭐️ plugin cache + verify github conn once #4976
base: afiune/parallel_asset_discovery
Are you sure you want to change the base?
⭐️ plugin cache + verify github conn once #4976
Conversation
Signed-off-by: Salim Afiune Maya <[email protected]>
Signed-off-by: Salim Afiune Maya <[email protected]>
Signed-off-by: Salim Afiune Maya <[email protected]>
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.
I think this is a more elegant way of achieving the same result. https://github.com/mondoohq/cnquery/blob/main/providers/github/resources/github.go#L18-L49
We have this memoizer which can cache responses for certain calls. It caches them for a configurable amount of time. We already use this in the github provider for caching users, for example. I think you can use a memoizer for the validation too
@@ -24,11 +25,14 @@ type Service struct { | |||
|
|||
lastHeartbeat int64 | |||
heartbeatLock sync.Mutex | |||
|
|||
Cache store.KeyValue |
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.
is this thread-safe? iirc w can have multiple conns using 1 provider?
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.
also, if we only need this for github, why not make it a github-connection specific thing?
was thinking out loud here, this is provider/plugin level
Testing ...
Follow up of #4973