Skip to content

Conversation

@chennin
Copy link

@chennin chennin commented Nov 15, 2021

Switches to bulk Mongo updates. On my 2CPU/2GB test VM, factions download and update goes from 90s to 7s. However, systems update is still unable to complete, and the others take about 10 minutes each.

Disclaimer: literally never touched Node before

On a better 4CPU/8GB test VM, I get:
commodity: ~6m 15s
factions: ~5s
stations: ~6m45s
populatedSystems: ~45s
...

TODO: bulkWrite does not invoke middleware. Check on the other middleware in the models and copy them.

updateOne: {
filter: {
id: json.id,
// updated_at: { $ne: json.updated_at }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is commented out because otherwise, Mongo returns a duplicate key error for every record NOT updated. It still updates any changed field, eg 0 inserted, 1000 matched, 1 modified, 0 upserted

@chennin chennin marked this pull request as draft November 15, 2021 21:45
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.

1 participant