Recalculate Organization.storedBytes in migration 0017 (#1220)

This commit is contained in:
Tessa Walsh 2023-09-28 14:22:10 -04:00 committed by GitHub
parent 9b125bc2c6
commit 1f74f03447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,11 +54,16 @@ class Migration(BaseMigration):
if profile_file:
bytes_stored_profiles += profile_file.get("size", 0)
org_total_bytes = (
bytes_stored_crawls + bytes_stored_uploads + bytes_stored_profiles
)
try:
res = await mdb_orgs.find_one_and_update(
{"_id": oid},
{
"$set": {
"bytesStored": org_total_bytes,
"bytesStoredCrawls": bytes_stored_crawls,
"bytesStoredUploads": bytes_stored_uploads,
"bytesStoredProfiles": bytes_stored_profiles,