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

Open
wants to merge 3 commits into
base: afiune/parallel_asset_discovery
Choose a base branch
from

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Dec 12, 2024

Testing ...

Follow up of #4973

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants