Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PB-1598]: feat/monitoring-polling-system #446

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
01eb624
fix: ignore duplicated nodes
JoanVicens Jan 10, 2024
e674d84
feat: comunicate the traverser error to user
JoanVicens Jan 10, 2024
26760f0
test: update traverser test
JoanVicens Jan 10, 2024
03f9e0b
chore: allow long error messages
JoanVicens Jan 10, 2024
6d1cb35
*add retry mechanism to try deleting folder *add logic to delete que…
migueldesarrollosoftware Jan 18, 2024
c9224c6
Add polling monitor start and stop functionality
migueldesarrollosoftware Jan 25, 2024
90c3aa5
Update polling interval in BindingManager and Builder
migueldesarrollosoftware Jan 26, 2024
56d5de6
update syncronizer
migueldesarrollosoftware Feb 2, 2024
a75c9b1
add placeholder converter
migueldesarrollosoftware Feb 8, 2024
85d88cd
add uuid on file
migueldesarrollosoftware Feb 8, 2024
da1b0f1
add replace function
migueldesarrollosoftware Feb 8, 2024
b2fa8e2
add replace contents function
migueldesarrollosoftware Feb 8, 2024
72fbad1
add implementation to update content
migueldesarrollosoftware Feb 8, 2024
7cd2aab
update sdk version
migueldesarrollosoftware Feb 8, 2024
2dd0007
fix file builder
migueldesarrollosoftware Feb 8, 2024
8a86280
add client update content
migueldesarrollosoftware Feb 9, 2024
d1b83ff
add forof to iterate each path
migueldesarrollosoftware Feb 9, 2024
0fc762c
fix issues and smell code
migueldesarrollosoftware Feb 9, 2024
e5d858a
**smeller code **rollback master-erb
migueldesarrollosoftware Feb 9, 2024
f0678a1
merge branch monitor into fix/lopp-deleting-files
migueldesarrollosoftware Feb 9, 2024
24eaa05
Merge branch 'monitoring-polling-system' of github.com:internxt/drive…
migueldesarrollosoftware Feb 9, 2024
8097851
Merge pull request #455 from internxt/update-content-sync
miguelsw Feb 9, 2024
9ac6b6a
Merge pull request #456 from internxt/fix/ignore-nodes-with-same-name
miguelsw Feb 9, 2024
09c59e8
Merge pull request #442 from internxt/fix/lopp-deleting-files
miguelsw Feb 9, 2024
9c0e6b4
add enum of placeholder state
migueldesarrollosoftware Feb 9, 2024
a63318a
add new sync status and getplaceholderstate and translation
migueldesarrollosoftware Feb 9, 2024
07718b1
add sync-pending in status
migueldesarrollosoftware Feb 12, 2024
ea40806
add ipc to render sync pending
migueldesarrollosoftware Feb 13, 2024
9736ab1
remove issues
migueldesarrollosoftware Feb 13, 2024
b157e7b
modify all to exists filter to get remote item
migueldesarrollosoftware Feb 14, 2024
0e9b312
modify the removing of files when logout and quit and update tests
migueldesarrollosoftware Feb 15, 2024
34e4234
patch: this awaits for files to download ?
JoanVicens Feb 19, 2024
6026a50
fix: reject error
JoanVicens Feb 20, 2024
eb2fbe5
add remove listener when stream appears
migueldesarrollosoftware Feb 22, 2024
241c75d
divide downloding and preparing process
migueldesarrollosoftware Feb 22, 2024
6a4a1ac
add preparing ux
migueldesarrollosoftware Feb 22, 2024
60afafc
add version 2.0.5 and remove smell
migueldesarrollosoftware Feb 22, 2024
65ac49a
Merge pull request #459 from internxt/patch/await-download
miguelsw Feb 22, 2024
9061f32
Merge pull request #457 from internxt/feat/fully-sync-update
miguelsw Feb 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "internxt-drive",
"version": "2.0.4",
"version": "2.0.5",
"author": "Internxt <[email protected]>",
"description": "Internxt Drive client UI",
"license": "AGPL-3.0",
Expand Down Expand Up @@ -264,7 +264,7 @@
"@iconscout/react-unicons": "^1.1.6",
"@internxt/inxt-js": "^2.0.8",
"@internxt/lib": "^1.1.6",
"@internxt/sdk": "^1.4.33",
"@internxt/sdk": "^1.4.68",
"@phosphor-icons/react": "2.0.9",
"@radix-ui/react-select": "^1.2.2",
"@sentry/electron": "^4.5.0",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "internxt-drive",
"version": "2.0.4",
"version": "2.0.5",
"description": "Internxt Drive client UI",
"main": "./dist/main/main.js",
"author": "Internxt <[email protected]>",
Expand Down
50 changes: 49 additions & 1 deletion release/app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
enabled "2.0.x"
kuler "^2.0.0"

"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0":
version "9.3.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==

"@hapi/topo@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
dependencies:
"@hapi/hoek" "^9.0.0"

"@ioredis/commands@^1.1.1":
version "1.2.0"
resolved "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz"
Expand Down Expand Up @@ -91,6 +103,23 @@
component-type "^1.2.1"
join-component "^1.1.0"

"@sideway/address@^4.1.5":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5"
integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==
dependencies:
"@hapi/hoek" "^9.0.0"

"@sideway/formula@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f"
integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==

"@sideway/pinpoint@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==

"@sqltools/formatter@^1.2.5":
version "1.2.5"
resolved "https://registry.npmjs.org/@sqltools/formatter/-/formatter-1.2.5.tgz"
Expand Down Expand Up @@ -374,6 +403,11 @@ dotenv@^16.0.3:
resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz"
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==

dotenv@^16.4.1:
version "16.4.4"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.4.tgz#a26e7bb95ebd36272ebb56edb80b826aecf224c1"
integrity sha512-XvPXc8XAQThSjAbY6cQ/9PcBXmFoWuw1sQ3b8HqUCR6ziGXjkTi//kB9SWa2UwqlgdAIuRqAa/9hVljzPehbYg==

emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz"
Expand Down Expand Up @@ -530,6 +564,17 @@ is-stream@^2.0.0:
resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz"
integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==

joi@^17.12.0:
version "17.12.1"
resolved "https://registry.yarnpkg.com/joi/-/joi-17.12.1.tgz#3347ecf4cd3301962d42191c021b165eef1f395b"
integrity sha512-vtxmq+Lsc5SlfqotnfVjlViWfOL9nt/avKNbKYizwf6gsCfq9NYY/ceYRMFD8XDdrjJ9abJyScWmhmIiy+XRtQ==
dependencies:
"@hapi/hoek" "^9.3.0"
"@hapi/topo" "^5.1.0"
"@sideway/address" "^4.1.5"
"@sideway/formula" "^3.0.1"
"@sideway/pinpoint" "^2.0.0"

join-component@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/join-component/-/join-component-1.1.0.tgz"
Expand Down Expand Up @@ -1031,7 +1076,10 @@ uuid@^9.0.0:
virtual-drive@../../../node-win:
version "1.0.1"
dependencies:
dotenv "^16.4.1"
joi "^17.12.0"
tsconfig-paths "^4.2.0"
yargs "^17.7.2"

winston-transport@^4.5.0:
version "4.5.0"
Expand Down Expand Up @@ -1106,7 +1154,7 @@ yargs@^16.0.0:
y18n "^5.0.5"
yargs-parser "^20.2.2"

yargs@^17.6.2:
yargs@^17.6.2, yargs@^17.7.2:
version "17.7.2"
resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz"
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
Expand Down
10 changes: 10 additions & 0 deletions src/apps/main/fordwardToWindows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ ipcMainDrive.on('FILE_DOWNLOADING', (_, payload) => {
});
});

ipcMainDrive.on('FILE_PREPARING', (_, payload) => {
const { nameWithExtension, processInfo } = payload;

broadcastToWindows('sync-info-update', {
action: 'PREPARING',
name: nameWithExtension,
progress: processInfo.progress,
});
});

ipcMainDrive.on('FILE_DOWNLOADED', (_, payload) => {
const { nameWithExtension } = payload;

Expand Down
22 changes: 19 additions & 3 deletions src/apps/main/remote-sync/RemoteSyncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { DriveFile } from '../database/entities/DriveFile';
export class RemoteSyncManager {
private foldersSyncStatus: RemoteSyncStatus = 'IDLE';
private filesSyncStatus: RemoteSyncStatus = 'IDLE';
private _placeholdersStatus: RemoteSyncStatus = 'IDLE';
private status: RemoteSyncStatus = 'IDLE';
private onStatusChangeCallbacks: Array<
(newStatus: RemoteSyncStatus) => void
Expand All @@ -34,9 +35,14 @@ export class RemoteSyncManager {
fetchFoldersLimitPerRequest: number;
syncFiles: boolean;
syncFolders: boolean;
}
} // , // private chekers: { // fileCheker: FileCheckerStatusInRoot; // }
) {}

set placeholderStatus(status: RemoteSyncStatus) {
this._placeholdersStatus = status;
this.checkRemoteSyncStatus();
}

onStatusChange(callback: (newStatus: RemoteSyncStatus) => void) {
if (typeof callback !== 'function') return;
this.onStatusChangeCallbacks.push(callback);
Expand Down Expand Up @@ -70,6 +76,7 @@ export class RemoteSyncManager {
async startRemoteSync() {
// const start = Date.now();
Logger.info('Starting remote to local sync');
Logger.info('Checking if we are in a valid state to start the sync');

const testPassed = this.smokeTest();

Expand Down Expand Up @@ -151,6 +158,15 @@ export class RemoteSyncManager {
}

private checkRemoteSyncStatus() {
if (this._placeholdersStatus === 'SYNCING') {
this.changeStatus('SYNCING');
return;
}
// placeholders are still sync-pending
if (this._placeholdersStatus === 'SYNC_PENDING') {
this.changeStatus('SYNC_PENDING');
return;
}
// We only syncing files
if (
this.config.syncFiles &&
Expand Down Expand Up @@ -319,7 +335,7 @@ export class RemoteSyncManager {
const params = {
limit: this.config.fetchFilesLimitPerRequest,
offset: 0,
status: 'ALL',
status: 'EXISTS',
updatedAt: updatedAtCheckpoint
? updatedAtCheckpoint.toISOString()
: undefined,
Expand Down Expand Up @@ -383,7 +399,7 @@ export class RemoteSyncManager {
const params = {
limit: this.config.fetchFilesLimitPerRequest,
offset: 0,
status: 'ALL',
status: 'EXISTS',
updatedAt: updatedAtCheckpoint
? updatedAtCheckpoint.toISOString()
: undefined,
Expand Down
16 changes: 16 additions & 0 deletions src/apps/main/remote-sync/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,19 @@ eventBus.on('USER_LOGGED_OUT', () => {
remoteSyncManager.resetRemoteSync();
clearRemoteSyncStore();
});

ipcMain.on('CHECK_SYNC', (event) => {
Logger.info('Checking sync');
event.sender.send(
'CHECK_SYNC_ENGINE_RESPONSE',
'Dato obtenido del proceso de sincronización'
);
});

ipcMain.on('CHECK_SYNC_CHANGE_STATUS', async (_, placeholderStates) => {
await sleep(2_000);
Logger.info('[SYNC ENGINE] Changing status');
remoteSyncManager.placeholderStatus = 'SYNCING';
await sleep(7_00);
remoteSyncManager.placeholderStatus = placeholderStates;
});
7 changes: 6 additions & 1 deletion src/apps/main/remote-sync/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ export type RemoteSyncedFolder = {
status: string;
};

export type RemoteSyncStatus = 'IDLE' | 'SYNCED' | 'SYNCING' | 'SYNC_FAILED';
export type RemoteSyncStatus =
| 'IDLE'
| 'SYNCED'
| 'SYNCING'
| 'SYNC_FAILED'
| 'SYNC_PENDING';
export type SyncConfig = {
retry: number;
maxRetries: number;
Expand Down
4 changes: 4 additions & 0 deletions src/apps/main/tray/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ ipcMainDrive.on('FILE_DOWNLOADING', () => {
setTrayStatus('SYNCING');
});

ipcMainDrive.on('FILE_PREPARING', () => {
setTrayStatus('SYNCING');
});

ipcMainDrive.on('FILE_DOWNLOADED', () => {
setTrayStatus('IDLE');
});
Expand Down
8 changes: 8 additions & 0 deletions src/apps/renderer/hooks/useSyncStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default function useSyncStatus(
if (status === 'SYNC_FAILED') {
setSyncStatus('FAILED');
}

if (status === 'SYNC_PENDING') {
setSyncStatus('SYNC PENDING');
}
});

const removeListener = window.electron.onRemoteSyncStatusChange(
Expand All @@ -34,6 +38,10 @@ export default function useSyncStatus(
if (newStatus === 'SYNC_FAILED') {
setSyncStatus('FAILED');
}

if (newStatus === 'SYNC_PENDING') {
setSyncStatus('SYNC PENDING');
}
}
);

Expand Down
4 changes: 3 additions & 1 deletion src/apps/renderer/localize/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"activity": {
"operation": {
"downloading": "Downloading",
"preparing": "Preparing",
"decrypting": "Decrypting",
"uploading": "Uploading",
"encrypting": "Encrypting",
Expand Down Expand Up @@ -174,7 +175,8 @@
"action-description": {
"syncing": "Syncing your files",
"updated": "Fully synced",
"failed": "Sync failed"
"failed": "Sync failed",
"sync-pending": "Sync pending"
},
"errors": {
"lock": "Sync locked by other device",
Expand Down
4 changes: 3 additions & 1 deletion src/apps/renderer/localize/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"activity": {
"operation": {
"downloading": "Descargando",
"preparing": "Preparando",
"decrypting": "Desencriptando",
"uploading": "Subiendo",
"encrypting": "Encriptando",
Expand Down Expand Up @@ -174,7 +175,8 @@
"action-description": {
"syncing": "Sincronizando tus archivos",
"updated": "Sincronizado",
"failed": "Sincronización fallida"
"failed": "Sincronización fallida",
"sync-pending": "Sincronización pendiente"
},
"errors": {
"lock": "Sincronización bloqueada por otro dispositivo",
Expand Down
4 changes: 3 additions & 1 deletion src/apps/renderer/localize/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"activity": {
"operation": {
"downloading": "Téléchargement",
"preparing": "Préparation",
"decrypting": "Décryptage",
"uploading": "téléchargement",
"encrypting": "Encryptage",
Expand Down Expand Up @@ -172,7 +173,8 @@
"footer": {
"action-description": {
"syncing": "Synchronisation de vos fichiers",
"updated": "Mis à jour il y a quelques instants"
"updated": "Mis à jour il y a quelques instants",
"sync-pending": "Synchronisation en attente"
},
"errors": {
"lock": "Synchronisation bloquée par un autre dispositif"
Expand Down
3 changes: 3 additions & 0 deletions src/apps/renderer/pages/Widget/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export function Item({
description = progress
? translate('widget.body.activity.operation.downloading')
: translate('widget.body.activity.operation.decrypting');
} else if (action === 'PREPARING') {
description = translate('widget.body.activity.operation.preparing');
} else if (action === 'UPLOADING') {
description = progress
? translate('widget.body.activity.operation.uploading')
Expand Down Expand Up @@ -94,6 +96,7 @@ export function Item({
{action &&
(action === 'UPLOADING' ||
action === 'DOWNLOADING' ||
action === 'PREPARING' ||
action === 'RENAMING' ||
action === 'DELETING') && (
<CircularProgressbar
Expand Down
16 changes: 16 additions & 0 deletions src/apps/renderer/pages/Widget/SyncAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTranslationContext } from '../../context/LocalContext';
import useVirtualDriveStatus from '../../hooks/VirtualDriveStatus';
import useSyncStatus from '../../hooks/useSyncStatus';
import useUsage from '../../hooks/useUsage';
import { WarningCircle } from 'phosphor-react';

export default function SyncAction(props: { syncStatus: SyncStatus }) {
const { translate } = useTranslationContext();
Expand Down Expand Up @@ -74,6 +75,21 @@ export default function SyncAction(props: { syncStatus: SyncStatus }) {
</span>
</>
)}
{isOnLine && props.syncStatus === 'SYNC PENDING' && (
<>
{/* UP TO DATE */}
<div className="relative z-0 flex w-5 items-center justify-center text-primary before:absolute before:-z-1 before:h-3 before:w-3 before:bg-white">
<WarningCircle
className="shrink-0"
size={22}
weight="fill"
/>
</div>
<span className="truncate">
{translate('widget.footer.action-description.sync-pending')}
</span>
</>
)}
</>
)
) : (
Expand Down
1 change: 1 addition & 0 deletions src/apps/shared/IPC/events/drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type UploadEvents = {

type DownloadEvents = {
FILE_DOWNLOADING: (payload: FileProgressInfo) => void;
FILE_PREPARING: (payload: FileProgressInfo) => void;
FILE_DOWNLOADED: (payload: FileProgressInfo) => void;
FILE_DOWNLOAD_ERROR: (payload: FileErrorInfo) => void;
};
Expand Down
1 change: 1 addition & 0 deletions src/apps/shared/IPC/events/sync-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export type FilesEvents = {
}) => void;

FILE_DOWNLOADING: (payload: FileUpdatePayload) => void;
FILE_PREPARING: (payload: FileUpdatePayload) => void;
FILE_DOWNLOADED: (payload: FileUpdatePayload) => void;
FILE_UPLOAD_ERROR: (payload: {
name: string;
Expand Down
Loading