Skip to content

Commit

Permalink
switch back to default instance class. Update img-sz values for new i…
Browse files Browse the repository at this point in the history
…mage formats.
  • Loading branch information
EagleLizard committed Nov 24, 2024
1 parent a9bec62 commit 65e2f9b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [START app_yaml]
runtime: nodejs20
instance_class: F4
# instance_class: F4
automatic_scaling:
max_concurrent_requests: 50
target_throughput_utilization: 0.85
Expand All @@ -13,4 +13,5 @@ automatic_scaling:
env_variables:
GCP_PROJECT_ID: "286428615502"
aws_access_key_id: "AKIAUKSW7EP4G66JAYXE"
JCD_IMG_V3_TO_V4: true
# [EMD app_yaml]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": ".eslintrc.js",
"scripts": {
"start": "node --optimize_for_size --max_old_space_size=460 index.js",
"start": "node --optimize_for_size --max_old_space_size=230 index.js",
"build": "rm -rf ./dist && tsc",
"dev": "nodemon -e ts,json,js --watch \"./dist/**/*\" --exec \"npm start\"",
"db:create": "node dist/db/create-db.js",
Expand Down
12 changes: 8 additions & 4 deletions src/models/img-sz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const ImgSzs = [
'md',
'lg',
'xl',
'xxl',
] as const;
export type ImgSz = typeof ImgSzs[number];
export const DEFAULT_IMG_SZ: ImgSz = 'lg';
Expand All @@ -29,16 +30,19 @@ export function imgSzFromDimensions(opts: {
return DEFAULT_IMG_SZ;
}
let dimension = Math.max(opts.width ?? 0, opts.height ?? 0);
if(dimension > 1920) {
if(dimension > 2100) {
return 'xxl';
}
if(dimension > 1600) {
return 'xl';
}
if(dimension > 1366) {
if(dimension > 1200) {
return 'lg';
}
if(dimension > 854) {
if(dimension > 800) {
return 'md';
}
if(dimension > 666) {
if(dimension > 500) {
return 'sm';
}
return 'xs';
Expand Down

0 comments on commit 65e2f9b

Please sign in to comment.