Recalculate Organization.storedBytes in migration 0017 (#1220)
This commit is contained in:
		
							parent
							
								
									9b125bc2c6
								
							
						
					
					
						commit
						1f74f03447
					
				| @ -54,11 +54,16 @@ class Migration(BaseMigration): | |||||||
|                 if profile_file: |                 if profile_file: | ||||||
|                     bytes_stored_profiles += profile_file.get("size", 0) |                     bytes_stored_profiles += profile_file.get("size", 0) | ||||||
| 
 | 
 | ||||||
|  |             org_total_bytes = ( | ||||||
|  |                 bytes_stored_crawls + bytes_stored_uploads + bytes_stored_profiles | ||||||
|  |             ) | ||||||
|  | 
 | ||||||
|             try: |             try: | ||||||
|                 res = await mdb_orgs.find_one_and_update( |                 res = await mdb_orgs.find_one_and_update( | ||||||
|                     {"_id": oid}, |                     {"_id": oid}, | ||||||
|                     { |                     { | ||||||
|                         "$set": { |                         "$set": { | ||||||
|  |                             "bytesStored": org_total_bytes, | ||||||
|                             "bytesStoredCrawls": bytes_stored_crawls, |                             "bytesStoredCrawls": bytes_stored_crawls, | ||||||
|                             "bytesStoredUploads": bytes_stored_uploads, |                             "bytesStoredUploads": bytes_stored_uploads, | ||||||
|                             "bytesStoredProfiles": bytes_stored_profiles, |                             "bytesStoredProfiles": bytes_stored_profiles, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user