@@ -10,7 +10,7 @@ import { Readable } from "node:stream";
10
10
type Docs = StructureDoc & {
11
11
structureUuid : string ;
12
12
} ;
13
- export class EncryptStructureDocsMigration1748264445999
13
+ export class EncryptStructureDocsMigration1748264443999
14
14
implements MigrationInterface
15
15
{
16
16
public fileManagerService : FileManagerService ;
@@ -26,7 +26,7 @@ export class EncryptStructureDocsMigration1748264445999
26
26
// eslint-disable-next-line @typescript-eslint/no-unused-vars
27
27
public async up ( _queryRunner : QueryRunner ) : Promise < void > {
28
28
appLogger . warn ( "[MIGRATION] Encrypt structure docs" ) ;
29
- await structureDocRepository . update ( { } , { encryptionContext : null } ) ;
29
+
30
30
const unencryptedDocs : Docs [ ] = await structureDocRepository
31
31
. createQueryBuilder ( "structure_doc" )
32
32
. leftJoin (
@@ -50,7 +50,7 @@ export class EncryptStructureDocsMigration1748264445999
50
50
) ;
51
51
const pLimit = ( await import ( "p-limit" ) ) . default ;
52
52
53
- const limit = pLimit ( 3 ) ;
53
+ const limit = pLimit ( 2 ) ;
54
54
55
55
const promises = unencryptedDocs . map ( ( doc ) =>
56
56
limit ( ( ) => this . processWithPause ( doc ) )
@@ -85,18 +85,17 @@ export class EncryptStructureDocsMigration1748264445999
85
85
} else {
86
86
appLogger . warn ( "⚠️ Migration completed with errors" ) ;
87
87
}
88
- throw new Error ( "pokpo" ) ;
89
88
}
90
89
91
90
public processWithPause = async ( doc : Docs ) => {
92
91
await this . processDoc ( doc ) ;
93
92
this . processedSinceLastPause ++ ;
94
93
95
- if ( this . processedSinceLastPause >= 6 ) {
94
+ if ( this . processedSinceLastPause >= 4 ) {
96
95
this . processedSinceLastPause = 0 ;
97
96
98
97
appLogger . info ( "⏸️ Wait one second " ) ;
99
- await new Promise ( ( resolve ) => setTimeout ( resolve , 1500 ) ) ;
98
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
100
99
}
101
100
} ;
102
101
0 commit comments