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

⭐️ plugin cache + verify github conn once #4976

Closed
wants to merge 13 commits into from

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Dec 12, 2024

Testing ...

Follow up of #4973

This will help us submit as many requests as we want without knowing
about the workers.

Signed-off-by: Salim Afiune Maya <[email protected]>
Signed-off-by: Salim Afiune Maya <[email protected]>
Signed-off-by: Salim Afiune Maya <[email protected]>
We really don't need to do everything inside the workerpool, do we?

Signed-off-by: Salim Afiune Maya <[email protected]>
Copy link
Contributor

github-actions bot commented Dec 12, 2024

Test Results

3 169 tests  ±0   3 168 ✅ ±0   1m 45s ⏱️ +4s
  374 suites +1       1 💤 ±0 
   28 files   ±0       0 ❌ ±0 

Results for commit ccf14cf. ± Comparison against base commit e3a58fd.

♻️ This comment has been updated with latest results.

Copy link
Member

@imilchev imilchev left a 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
Copy link
Contributor

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?

Copy link
Contributor

@preslavgerchev preslavgerchev Dec 13, 2024

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

@afiune
Copy link
Contributor Author

afiune commented Dec 14, 2024

@imilchev if we want that approach, lets review this PR instead #4980

I still think having a key value cache out-of-the-box for providers is a nice thing to have. But that is a discussion for later.

Base automatically changed from afiune/parallel_asset_discovery to main December 16, 2024 09:12
@afiune afiune closed this Dec 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants