-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix client provider dist acc aggregation crashing #65
base: develop
Are you sure you want to change the base?
Conversation
d913270
to
94454b0
Compare
@@ -65,7 +65,7 @@ | |||
"eslint-plugin-prettier": "^5.2.1", | |||
"jest": "^29.7.0", | |||
"prettier": "^3.3.3", | |||
"prisma": "^5.22.0", | |||
"prisma": "^6.0.1", |
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.
Makes it consistent with @prisma/client
@@ -1,7 +1,7 @@ | |||
generator client { | |||
provider = "prisma-client-js" | |||
output = "./generated/client" | |||
previewFeatures = ["typedSql", "omitApi", "metrics"] | |||
previewFeatures = ["typedSql", "metrics"] |
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.
It's no longer a preview feature in prisma 6
//const latestStored = | ||
// await prismaService.client_provider_distribution_weekly_acc.findFirst({ | ||
// select: { | ||
// week: true, | ||
// }, | ||
// orderBy: { | ||
// week: 'desc', | ||
// }, | ||
// }); | ||
//let nextWeek = latestStored | ||
// ? DateTime.fromJSDate(latestStored.date, { zone: 'UTC' }) // we want to reprocess the last stored week, as it might've been incomplete | ||
// : DateTime.fromSeconds(3847920 * 30 + 1598306400).startOf('week'); // nv22 start week - a.k.a. reprocess everything |
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 commented code is for incremental processing - it only recalculates since last processed week (inclusive, as last processed week could be incomplete or could be current ongoing week).
My plan is to first do the uncommented version that simply reprocesses everything every time. That's because we actually need to recalculate current data - it's wrong, data uniqueness was only calculated "per week" and not "up to a week". So a client could store that same data with the same SP on week 1 and week 2 and it wouldn't detect it as duplicates.
After it runs at least once, we can switch to the incremental version for performance.
94454b0
to
eb3e3e7
Compare
eb3e3e7
to
2a3cb95
Compare
This PR:
truncate
todelete all
for data consistency (though this will need to be monitored closely by @lukasz-wal to make sure the DB can handle vacuuming this)The biggest issue I see that this new aggregation on it's own requires ~2h. But that's a temporary until we switch to the incremental version, which will take <5 minutes.