Skip to content

Commit

Permalink
🐛 Last sync applied only between subsequent sync jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Oct 9, 2024
1 parent c8c834c commit 5888e8f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/api/src/filestorage/file/services/googledrive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ export class GoogleDriveService implements IFileService {
});
const drive = google.drive({ version: 'v3', auth });

const lastSyncTime = await this.getLastSyncTime(connection.id_connection);
const query = lastSyncTime
? `trashed = false and modifiedTime > '${lastSyncTime.toISOString()}'`
: 'trashed = false';

let query = 'trashed = false';
if (!pageToken) {
const lastSyncTime = await this.getLastSyncTime(connection.id_connection);
if (lastSyncTime) {
console.log(`Last sync time is ${lastSyncTime.toISOString()}`);
query += ` and modifiedTime > '${lastSyncTime.toISOString()}'`;
}
}
// Fetch the current page of files
const response = await this.rateLimitedRequest(() =>
drive.files.list({
Expand Down

0 comments on commit 5888e8f

Please sign in to comment.