-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Pics Cache Enhancements #389
Pics Cache Enhancements #389
Conversation
@DoctorMcKay early feedback is welcome and encouraged! |
It does make sense to request missing tokens by default, but this would be a breaking change so it's best not to. |
README.md
Outdated
|
||
Defaults to `false`. | ||
|
||
**Warning:** This will significantly increase the storage space that is needed! |
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.
How much disk space does this need? Might it be worthwhile to gzip the json before we store it?
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 should add "potentially", because it all depends on how many products you will be requesting. But it will build up over time, of course.
As for your first question, I once saved the entire SteamUser instance to disk as JSON. This was around 140 MB and the majority of that data consisted of the pics cache JSON. That was 4 years ago and my library has grown from then. Anyway, it will be in the order of hundreds of MB. Maybe getting into the gigabytes eventually, if you are going to monitor all pics changes. Using the custom file engine, one may implement a database hook instead.
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.
So, with the main functionality added now, I got this by just saving my owned products infos to disk:
I think that's reasonable, especially with my unreasonable library size :P
People can always choose to not save pics cache to disk anyway.
The danger lies if people also use picsCacheAll
, and potentially save product infos of everything. I've added a warning especially for this.
Hmm, I'm thinking, maybe just like the global |
Ehh, I'm not a big fan of adding a new global option just to avoid having to type |
Fair enough |
@@ -137,7 +137,7 @@ class SteamUserApps extends SteamUserAppAuth { | |||
* Get a list of apps or packages which have changed since a particular changenumber. | |||
* @param {int} sinceChangenumber - Changenumber to get changes since. Use 0 to get the latest changenumber, but nothing else | |||
* @param {function} [callback] | |||
* @returns {Promise<{currentChangeNumber: number, appChanges: number[], packageChanges: number[]}>} | |||
* @returns {Promise<{currentChangeNumber: number, appChanges: object[], packageChanges: object[]}>} |
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 was wrong, btw. I fixed it.
|
||
for (let appid in apps) { | ||
// Public only apps are weird... | ||
if (apps[appid].missingToken && !apps[appid].appinfo.public_only) { |
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'm really conflicted about this and would love your input. Should I save product infos with missing tokens?
Initially, I would say yes, but that will lead to a difficult to handle situation: when you activate a new product on steam, it will not update your cached product info. Currently, it only updates saved pics cache when changes have been detected since last synced changenumber
.
Additionally, there is the case of public_only
apps. These are weird, since even if you own it, you cannot seem to request product access tokens for them?
// This one actually can take a while, so allow it to go as long as 60 minutes | ||
return StdLib.Promises.timeoutCallbackPromise(3600000, ['apps', 'packages', 'unknownApps', 'unknownPackages'], callback, (resolve, reject) => { | ||
// This one actually can take a while, so allow it to go as long as 120 minutes | ||
return StdLib.Promises.timeoutCallbackPromise(7200000, ['apps', 'packages', 'unknownApps', 'unknownPackages'], callback, async (resolve, reject) => { |
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.
Increased to 2h, because one of the top game owners on steam is trying to use node-steam-user
but has issues getting passed this point.
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.
Increased to 2h, because one of the top game owners on steam is trying to use
node-steam-user
but has issues getting passed this point.
Btw, I can confirm with all my changes, this person was able to finally get his ownership cached. 🎉🎉
New TODO:
|
b92130b
to
3249f29
Compare
New TODO:
|
} | ||
|
||
if (this.options.picsCacheAll && this.options.savePicsCache) { | ||
this._warn('Both picsCacheAll and savePicsCache are enabled. Unless a custom storage engine is used, beware that this will cause a lot of disk IO and space usage!'); |
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's a good idea to detect custom storage usage, somehow...
|
||
If `enablePicsCache` is enabled, saves all product info from [the PICS cache](#picscache) to disk (in [`dataDirectory`](#dataDirectory)) or to your [Custom Storage Engine](#custom-storage-engine). This will significantly speed up the [`appOwnershipCached`](#appOwnershipCache) event from firing and reduce the amount product info requests to Steam. It will only save product info if it's not missing its access token. | ||
|
||
Added in {{TODO}} |
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.
Pending version bump
// "pkg cache:", Object.keys(cached.packages).length, | ||
// "app to refresh:", apps.length, | ||
// "pkg to refresh:", packages.length, | ||
// ); |
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.
Should I keep this? It's a great log for debugging purposes.
Bug found: requesting product info of subids/appids as string results in deadlock. Edit: |
Ready to merge? |
appOwnershipCached
#385)getProductInfo()
(comments 1 2)Request missing tokens by default? (discussion)meta_data_only
instead of tracking changenumber (reason: changenumber changes can be only requested until a certain point)