+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

feat: Addon Cache #315

Merged
merged 8 commits into from
Oct 31, 2020
Merged

feat: Addon Cache #315

merged 8 commits into from
Oct 31, 2020

Conversation

tarkah
Copy link
Member

@tarkah tarkah commented Oct 27, 2020

Resolves adding Tukui and WowI reliably to catalog

Proposed Changes

  • Cache addon api and folder grouping data for Tukui and WowI addons installed through catalog since those APIs don't give us fingerprinting / modules like Curse and the addon folders are unreliable for getting repo IDs and impossible to determine grouping off of
  • Use this cache when parsing addons so we can reliably group / get repo metadata for these addons

Checklist

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users

@tarkah tarkah changed the base branch from master to development October 27, 2020 22:17
@tarkah
Copy link
Member Author

tarkah commented Oct 27, 2020

Just need to account for the cache during parsing and this will be done!

@casperstorm casperstorm mentioned this pull request Oct 28, 2020
2 tasks
@mlablah
Copy link
Collaborator

mlablah commented Oct 29, 2020

I was sent a build from this branch and I had a go using it. I pointed it at a directory where I have top 50 retail addons from curseforge (listed as 69 addons due to altoholic containing other addons), installed via catalog 10 days ago.

There are also addons in the folders for the other game flavors but those can be ignored.

I then hit "Update All" and ajour panicked and shut down. Attached is zipped version of ajour's appdata and a screenshot showing 14 temp files left behind afterwards.

My guess is that the panic was caused by altoholic which has matched addons that are subsets of another matched addon causing problems when altoholic and its sub-addons are trying to update the same files. I don't know if the problem is new to this branch.

08:43:16.230 [panic][ERROR] thread 'main' panicked at 'called Option::unwrap() on a None value': src\gui\update.rs:788

logs.zip

Edit: note in screenshot that it has downloaded both Altoholic and Datastore_Keystones. The latter is contained in the former.

@casperstorm
Copy link
Member

casperstorm commented Oct 29, 2020

Looks like its DataStore_Reputations (2623891795) which causes the crash.
It couldn't create a primary_folder_id from the response.

It seems like that fingerprint matches classic version Altoholic 🙃

altoholic_addon.zip

@tarkah
Copy link
Member Author

tarkah commented Oct 30, 2020

Yeah, so what appears to be happening is that due to how FUBAR Altoholic is, it's trying to download the main Altoholic addon, on top of the individual addon for each Datastore. Because the main Altoholic addon contains each folder, there is a high chance that there will be a collision while it's unpacking one of the Datastore folders, with the unpacking on that same Datastore folder from the individual addon. At the end of our unpack function, we parse all the unpacked folders into AddonFolder

let addon_folders = toc_files.iter().filter_map(parse_toc_path).collect();

When it was doing this for the individual addon for DataStore_Reputations, the main Altoholic addon was also unpacking, and was probably mid-unpacking it's DataStore_Reputations folder, while the other one was trying to parse it. When it tried to parse it, the .toc didn't exist (due to the collision, it was still being fully unpacked) and therefore it returned an empty Vec. Which is why this failed:

//TODO: Can this crash? What do we do in that case.
folders.get(0).map(|f| f.id.clone()).unwrap()

Because the were no successfully parsed AddonFolder in the vec.

I've added if !folders.is_empty() { as protection in this scenario.

@casperstorm
Copy link
Member

No remarks. Looks good, and tests was good.

@tarkah tarkah requested a review from casperstorm October 31, 2020 21:21
@tarkah tarkah marked this pull request as ready for review October 31, 2020 21:21
@tarkah
Copy link
Member Author

tarkah commented Oct 31, 2020

@casperstorm just double check my changes to config loading initially and I think this is good to go

@tarkah tarkah merged commit c15fefb into development Oct 31, 2020
@tarkah tarkah deleted the feat/install-cache branch October 31, 2020 21:27
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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载