Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

feat(list): list seeder #4

Merged
merged 2 commits into from
Mar 1, 2022
Merged

feat(list): list seeder #4

merged 2 commits into from
Mar 1, 2022

Conversation

kschelonka
Copy link
Contributor

Goal

Seed some configurable benchmarking data that is somewhat realistic.

References

Issues:

Implementation Decisions

  • Just doing the minimum schema for list testing
  • Choosing reasonable defaults for title, etc.

@kschelonka kschelonka requested a review from a team as a code owner March 1, 2022 01:20
@kschelonka kschelonka requested review from kkyeboah and nina-py March 1, 2022 01:20
@kschelonka kschelonka force-pushed the INFRA-311/feat/seed-list branch from 2344af2 to 6236284 Compare March 1, 2022 01:21
src/seeds/list.ts Outdated Show resolved Hide resolved
const isFavorite = Math.random() < favoriteRate;
const isArticle = Math.random() < articleRate; // otherwise video

listData[index % batchSize] = {
Copy link

@Herraj Herraj Mar 1, 2022

Choose a reason for hiding this comment

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

Correct me if I'm wrong, we insert items in this listData array from index 0 --> 100 (batch size), yield that listData and then start again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, and it reuses the same array hence the modulo indexing. Using a generator keeps us from accidentally making massive datasets that make your computer run out of memory

@Herraj Herraj self-requested a review March 1, 2022 19:23
@kschelonka kschelonka merged commit 0441e3a into main Mar 1, 2022
@kschelonka kschelonka deleted the INFRA-311/feat/seed-list branch March 1, 2022 19:50
@pocket-ci
Copy link

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants