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

Bump demo site's size limit to 2GB from 250MB #805

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const SCREENSHOT_WIDTH = 1040;
export const SCREENSHOT_HEIGHT = 1248;
export const LIMIT_OF_ZIP_SITES_PER_USER = 5;
export const LIMIT_OF_PROMPTS_PER_USER = 200;
export const DEMO_SITE_SIZE_LIMIT_MB = 250;
export const DEMO_SITE_SIZE_LIMIT_BYTES = DEMO_SITE_SIZE_LIMIT_MB * 1024 * 1024; // 250MB
export const DEMO_SITE_SIZE_LIMIT_GB = 2;
export const DEMO_SITE_SIZE_LIMIT_BYTES = DEMO_SITE_SIZE_LIMIT_GB * 1024 * 1024 * 1024; // 2GB
export const SYNC_PUSH_SIZE_LIMIT_GB = 2;
export const SYNC_PUSH_SIZE_LIMIT_BYTES = SYNC_PUSH_SIZE_LIMIT_GB * 1024 * 1024 * 1024; // 2GB
Comment on lines +9 to 12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past, we separated the limits for Demo sites and Sync Push. Now that we’ve decided both should share the same limit, I considered if it would make sense to consolidate them into a single variable again. However, keeping two distinct variables seems cleaner and provides greater flexibility for future adjustments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! Consolidating only makes sense if it's guaranteed to not diverge in future.

export const AUTO_UPDATE_INTERVAL_MS = 60 * 60 * 1000;
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/use-archive-error-messages.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sprintf } from '@wordpress/i18n';
import { useI18n } from '@wordpress/react-i18n';
import { useMemo } from 'react';
import { DEMO_SITE_SIZE_LIMIT_MB } from '../constants';
import { DEMO_SITE_SIZE_LIMIT_GB } from '../constants';

export function useArchiveErrorMessages() {
const { __ } = useI18n();
Expand All @@ -12,8 +12,8 @@ export function useArchiveErrorMessages() {
rest_site_limit_reached: __( 'Demo sites limit reached. Please, delete some demo sites.' ),
no_file: __( "We didn't receive the zip file. Please try uploading it again." ),
invalid_file_size: sprintf(
__( 'The file size exceeds the limit of %d MB. Please try reducing the site size.' ),
DEMO_SITE_SIZE_LIMIT_MB
__( 'The file size exceeds the limit of %d GB. Please try reducing the site size.' ),
DEMO_SITE_SIZE_LIMIT_GB
),
could_not_upload: __( 'There was an issue uploading the zip file.' ),
rest_cannot_view: __(
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/use-archive-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Sentry from '@sentry/electron/renderer';
import { sprintf } from '@wordpress/i18n';
import { useI18n } from '@wordpress/react-i18n';
import { useCallback, useEffect, useMemo } from 'react';
import { DEMO_SITE_SIZE_LIMIT_BYTES, DEMO_SITE_SIZE_LIMIT_MB } from '../constants';
import { DEMO_SITE_SIZE_LIMIT_BYTES, DEMO_SITE_SIZE_LIMIT_GB } from '../constants';
import { getIpcApi } from '../lib/get-ipc-api';
import { isWpcomNetworkError } from '../lib/is-wpcom-network-error';
import { useArchiveErrorMessages } from './use-archive-error-messages';
Expand Down Expand Up @@ -87,9 +87,9 @@ export function useArchiveSite() {
alert(
sprintf(
__(
'The site exceeds the maximum size of %dMB. Please remove some files and try again.'
'The site exceeds the maximum size of %dGB. Please remove some files and try again.'
),
DEMO_SITE_SIZE_LIMIT_MB
DEMO_SITE_SIZE_LIMIT_GB
)
);
setUploadingSites( ( _uploadingSites ) => ( { ..._uploadingSites, [ siteId ]: false } ) );
Expand Down
Loading