New datasource.getPackageMeta() function #24930
Replies: 10 comments
-
Example datasources where this could be used right away: crate, rubygems |
Beta Was this translation helpful? Give feedback.
-
@JamieMagee how do you suggest this works with your new class based approach? |
Beta Was this translation helpful? Give feedback.
-
Pretty well? If it's renovate/lib/datasource/datasource.ts Lines 30 to 32 in f54ff20 To make it optional, like renovate/lib/datasource/datasource.ts Line 37 in f54ff20 |
Beta Was this translation helpful? Give feedback.
-
Great. It would be optional, and probably needs a custom cache time per datasource for this, separate from the releases cache time |
Beta Was this translation helpful? Give feedback.
-
@JamieMagee how would you suggest having a different cache and expiry for
renovate/lib/datasource/datasource.ts Line 16 in ac408e4 And here's an example of the crate datasource using the renovate/lib/datasource/crate/index.ts Lines 30 to 36 in ac408e4 Would we need two decorators? |
Beta Was this translation helpful? Give feedback.
-
The cache decorator doesn't read the cache property. It has its own cacheable property that takes a function and returns a boolean. I think it's already generic enough to be reused. The only caveat is that it can only be applied to async functions right now. (I'm AFK this weekend, so this is from memory) |
Beta Was this translation helpful? Give feedback.
-
@JamieMagee do you think that the approach taken for the |
Beta Was this translation helpful? Give feedback.
-
I think it could still be useful to have if there are more managers that would use it. If it's just Don't feel bad about the PR 😅 |
Beta Was this translation helpful? Give feedback.
-
I thiunk it's useful. We can extract more metadata handling from datasources to more generalize and long term caching. |
Beta Was this translation helpful? Give feedback.
-
OK. Maybe we can port over the crates logic first |
Beta Was this translation helpful? Give feedback.
-
What would you like Renovate to be able to do?
Support
datasource.getPackageMeta()
which is an optional interface to complementdatasource.getPackageReleases()
.Did you already have any implementation ideas?
Sometimes we can get the list of releases efficiently, but fetching the metadata for the package (e.g. source URL) is not efficient, e.g. a separate and potentially rate-limited API. In such cases we should separate out the
getReleases()
logic - which might typically have a 10-15 minute cache time - fromgetPackageMeta()
, which could even have a 1 day cache time. Then when doing a lookup we return the merged results ofgetPackageMeta()
withgetReleases()
Beta Was this translation helpful? Give feedback.
All reactions