From cab9d9c3e7be88ec326ab2000e51254e1c8a80ed Mon Sep 17 00:00:00 2001 From: Mudit Mahajan Date: Wed, 17 Apr 2024 18:04:37 +0530 Subject: [PATCH 1/6] Fix bug in BusinessDashboardPage component --- src/ui/app/influencer/dashboard/page.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/app/influencer/dashboard/page.tsx b/src/ui/app/influencer/dashboard/page.tsx index f32ae6b8..5cede94c 100644 --- a/src/ui/app/influencer/dashboard/page.tsx +++ b/src/ui/app/influencer/dashboard/page.tsx @@ -1106,6 +1106,7 @@ export default function BusinessDashboardPage() { {params?.row?.approved && (params?.row?.status === ORDER_ITEM_STATUS.ACCEPTED || params?.row?.status === ORDER_ITEM_STATUS.CANCELLED) && + params?.row?.order_id?.status === ORDER_STATUS.ACCEPTED && // Publish date is in the future dayjs(params?.row?.publish_date) > dayjs() && ( From b384c41c064a5269b2a97411b0d881f24e608bdb Mon Sep 17 00:00:00 2001 From: Mudit Mahajan Date: Wed, 17 Apr 2024 18:04:45 +0530 Subject: [PATCH 2/6] Refactor Services component to include pagination and status filtering --- .../profile/[id]/_services/index.tsx | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/ui/app/influencer/profile/[id]/_services/index.tsx b/src/ui/app/influencer/profile/[id]/_services/index.tsx index 84c11186..d011c0e9 100644 --- a/src/ui/app/influencer/profile/[id]/_services/index.tsx +++ b/src/ui/app/influencer/profile/[id]/_services/index.tsx @@ -37,7 +37,7 @@ const Services = ({ const dispatch = useAppDispatch(); const cart = useAppSelector((state) => state.cart); const loggedInUser = useAppSelector((state) => state.user?.user); - const [type, setType] = React.useState(null); + const [type, setType] = React.useState("published"); const [services, setServices] = React.useState([]); const [pagination, setPagination] = React.useState({ total_data_count: 0, @@ -62,12 +62,9 @@ const Services = ({ "packages/service", { page_number: pagination.current_page_number, - page_size: - id === loggedInUser?.id - ? pagination.current_page_size - : pagination.current_page_size + 1, + page_size: pagination.current_page_size, influencer: id, - status: id === loggedInUser?.id ? type : "published", + status: type, } ); if (isSuccess) { @@ -120,6 +117,18 @@ const Services = ({ } }, [refreshPage]); + useEffect(() => { + if (id && loggedInUser && loggedInUser?.id && loggedInUser?.id === id) { + setType(null); + setPagination({ + total_data_count: 0, + total_page_count: 0, + current_page_number: 1, + current_page_size: 8, + }); + } + }, [loggedInUser, id]); + useEffect(() => { getServices(); }, [pagination.current_page_number, pagination.current_page_size, type]); From d49fc5bd770a212094fafc16db1305bb909b975c Mon Sep 17 00:00:00 2001 From: Mudit Mahajan Date: Wed, 17 Apr 2024 18:06:11 +0530 Subject: [PATCH 3/6] Update gunicorn command to include a timeout of 300 seconds --- .github/workflows/deploy_api.yml | 2 +- .github/workflows/deploy_prod_api.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_api.yml b/.github/workflows/deploy_api.yml index 3e2e3c59..981f26b1 100644 --- a/.github/workflows/deploy_api.yml +++ b/.github/workflows/deploy_api.yml @@ -49,7 +49,7 @@ jobs: echo "Starting redis service..." sudo systemctl start redis echo "Starting gunicorn..." - nohup sh -c 'gunicorn -w 4 marketplace.wsgi:application > gunicorn.out 2>&1' & + nohup sh -c 'gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & echo "Gunicorn started." echo "Starting celery worker..." nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & diff --git a/.github/workflows/deploy_prod_api.yml b/.github/workflows/deploy_prod_api.yml index edbdf38b..2319cea3 100644 --- a/.github/workflows/deploy_prod_api.yml +++ b/.github/workflows/deploy_prod_api.yml @@ -51,7 +51,7 @@ jobs: echo "Starting redis service..." sudo systemctl start redis echo "Starting gunicorn..." - nohup sh -c 'gunicorn -w 4 marketplace.wsgi:application > gunicorn.out 2>&1' & + nohup sh -c 'gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & echo "Gunicorn started." echo "Starting celery worker..." nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & From 3100d43c1081c2a44349f5b47b3cbc38bfa811fb Mon Sep 17 00:00:00 2001 From: Mudit Mahajan Date: Wed, 17 Apr 2024 18:11:21 +0530 Subject: [PATCH 4/6] Update gunicorn command to include stdbuf for line buffering --- .github/workflows/deploy_api.yml | 2 +- .github/workflows/deploy_prod_api.yml | 2 +- .github/workflows/deploy_ui.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy_api.yml b/.github/workflows/deploy_api.yml index 981f26b1..8dcbf888 100644 --- a/.github/workflows/deploy_api.yml +++ b/.github/workflows/deploy_api.yml @@ -49,7 +49,7 @@ jobs: echo "Starting redis service..." sudo systemctl start redis echo "Starting gunicorn..." - nohup sh -c 'gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & + nohup sh -c 'stdbuf -oL gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & echo "Gunicorn started." echo "Starting celery worker..." nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & diff --git a/.github/workflows/deploy_prod_api.yml b/.github/workflows/deploy_prod_api.yml index 2319cea3..aaeca9c5 100644 --- a/.github/workflows/deploy_prod_api.yml +++ b/.github/workflows/deploy_prod_api.yml @@ -51,7 +51,7 @@ jobs: echo "Starting redis service..." sudo systemctl start redis echo "Starting gunicorn..." - nohup sh -c 'gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & + nohup sh -c 'stdbuf -oL gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & echo "Gunicorn started." echo "Starting celery worker..." nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & diff --git a/.github/workflows/deploy_ui.yml b/.github/workflows/deploy_ui.yml index b3f86279..c6146860 100644 --- a/.github/workflows/deploy_ui.yml +++ b/.github/workflows/deploy_ui.yml @@ -42,7 +42,7 @@ jobs: npm install npm run build sudo systemctl restart nginx - pm2 stop marketplace + pm2 delete marketplace pm2 start npm --name marketplace -- start - name: Remove Github Actions IP from security group From deddf3c83426abcf5ea3b11a0587fb4ee02465aa Mon Sep 17 00:00:00 2001 From: Mudit Mahajan Date: Thu, 18 Apr 2024 11:36:40 +0530 Subject: [PATCH 5/6] Update gunicorn command to include line buffering --- .github/workflows/deploy_api.yml | 2 +- .github/workflows/deploy_prod_api.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_api.yml b/.github/workflows/deploy_api.yml index 8dcbf888..9df543c0 100644 --- a/.github/workflows/deploy_api.yml +++ b/.github/workflows/deploy_api.yml @@ -49,7 +49,7 @@ jobs: echo "Starting redis service..." sudo systemctl start redis echo "Starting gunicorn..." - nohup sh -c 'stdbuf -oL gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & + nohup sh -c 'gunicorn -w 4 --access-logfile - --error-logfile - --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & echo "Gunicorn started." echo "Starting celery worker..." nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & diff --git a/.github/workflows/deploy_prod_api.yml b/.github/workflows/deploy_prod_api.yml index aaeca9c5..e5b4bf3c 100644 --- a/.github/workflows/deploy_prod_api.yml +++ b/.github/workflows/deploy_prod_api.yml @@ -51,7 +51,7 @@ jobs: echo "Starting redis service..." sudo systemctl start redis echo "Starting gunicorn..." - nohup sh -c 'stdbuf -oL gunicorn -w 4 --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & + nohup sh -c 'gunicorn -w 4 --access-logfile - --error-logfile - --timeout 300 marketplace.wsgi:application > gunicorn.out 2>&1' & echo "Gunicorn started." echo "Starting celery worker..." nohup sh -c 'celery -A marketplace worker -l info > celery_worker.out 2>&1' & From e70d8b7091bbccbd1670ecd36462c2a02c91362a Mon Sep 17 00:00:00 2001 From: Mudit Mahajan Date: Thu, 18 Apr 2024 11:42:34 +0530 Subject: [PATCH 6/6] Remove pagination change in useEffect --- src/ui/app/influencer/profile/[id]/_services/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/ui/app/influencer/profile/[id]/_services/index.tsx b/src/ui/app/influencer/profile/[id]/_services/index.tsx index d011c0e9..8ca824e0 100644 --- a/src/ui/app/influencer/profile/[id]/_services/index.tsx +++ b/src/ui/app/influencer/profile/[id]/_services/index.tsx @@ -58,7 +58,7 @@ const Services = ({ const getServices = async () => { try { setLoading(true); - const { message, data, isSuccess, errors } = await getService( + const { message, data, isSuccess } = await getService( "packages/service", { page_number: pagination.current_page_number, @@ -120,12 +120,6 @@ const Services = ({ useEffect(() => { if (id && loggedInUser && loggedInUser?.id && loggedInUser?.id === id) { setType(null); - setPagination({ - total_data_count: 0, - total_page_count: 0, - current_page_number: 1, - current_page_size: 8, - }); } }, [loggedInUser, id]);