@@ -618,7 +618,7 @@ export class PreAggregationLoader {
618618 dropSourceTempTable : boolean ,
619619 ) {
620620 if ( withTempTable && dropSourceTempTable ) {
621- await this . withDropLock ( false , async ( ) => {
621+ await this . withDropLock ( `drop-temp-table: ${ this . preAggregation . dataSource } : ${ targetTableName } ` , async ( ) => {
622622 this . logger ( 'Dropping source temp table' , queryOptions ) ;
623623
624624 const actualTables = await client . getTablesQuery ( this . preAggregation . preAggregationsSchema ) ;
@@ -965,8 +965,7 @@ export class PreAggregationLoader {
965965 } ) ;
966966 }
967967
968- private async withDropLock < T > ( external : boolean , lockFn : ( ) => MaybeCancelablePromise < T > ) : Promise < boolean > {
969- const lockKey = this . dropLockKey ( external ) ;
968+ private async withDropLock < T > ( lockKey : string , lockFn : ( ) => MaybeCancelablePromise < T > ) : Promise < boolean > {
970969 return this . queryCache . withLock ( lockKey , 60 * 5 , lockFn ) ;
971970 }
972971
@@ -979,7 +978,7 @@ export class PreAggregationLoader {
979978 ) {
980979 await this . preAggregations . addTableUsed ( justCreatedTable ) ;
981980
982- return this . withDropLock ( external , async ( ) => {
981+ return this . withDropLock ( this . dropOrphanedLockKey ( external ) , async ( ) => {
983982 this . logger ( 'Dropping orphaned tables' , { ...queryOptions , external } ) ;
984983 const actualTables = await client . getTablesQuery (
985984 this . preAggregation . preAggregationsSchema ,
@@ -1039,7 +1038,7 @@ export class PreAggregationLoader {
10391038 } ) ;
10401039 }
10411040
1042- private dropLockKey ( external : boolean ) {
1041+ private dropOrphanedLockKey ( external : boolean ) {
10431042 return external
10441043 ? 'drop-orphaned-tables-external'
10451044 : `drop-orphaned-tables:${ this . preAggregation . dataSource } ` ;
0 commit comments