From d2e2478e06761a18a31409b06a0d76df2fef4b33 Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 17 May 2023 14:04:48 -0400 Subject: [PATCH] fixed pyl issues and set max threads based on cpu cores w/ burnettk --- spiffworkflow-backend/bin/boot_server_in_docker | 4 ++-- spiffworkflow-frontend/src/App.tsx | 4 ++-- .../src/components/ScrollToTop.tsx | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spiffworkflow-backend/bin/boot_server_in_docker b/spiffworkflow-backend/bin/boot_server_in_docker index a26adc739..96d3d79fd 100755 --- a/spiffworkflow-backend/bin/boot_server_in_docker +++ b/spiffworkflow-backend/bin/boot_server_in_docker @@ -75,14 +75,14 @@ if [[ -z "${SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER:-}" ]]; then # I/O heavy, make it larger threads_to_use_per_core=3 - # just making up a number here for num_cores_multiple_for_threads # https://stackoverflow.com/a/55423170/6090676 # if we had access to python (i'm not sure i want to run another python script here), # we could do something like this (on linux) to get the number of cores available to this process and a better estimate of a # reasonable num_cores_multiple_for_threads # if hasattr(os, 'sched_getaffinity') # number_of_available_cores = os.sched_getaffinity(0) - num_cores_multiple_for_threads=2 + # BUT the python solution isn't even as portable as this one, which is mostly posix compliant and works on linux/mac/freebsd. + num_cores_multiple_for_threads=$(getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1) SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER=$((threads_to_use_per_core * num_cores_multiple_for_threads)) export SPIFFWORKFLOW_BACKEND_THREADS_PER_WORKER diff --git a/spiffworkflow-frontend/src/App.tsx b/spiffworkflow-frontend/src/App.tsx index 17afca14d..cddc30615 100644 --- a/spiffworkflow-frontend/src/App.tsx +++ b/spiffworkflow-frontend/src/App.tsx @@ -3,6 +3,7 @@ import { Content } from '@carbon/react'; import { BrowserRouter, Routes, Route } from 'react-router-dom'; import { defineAbility } from '@casl/ability'; +import React from 'react'; import NavigationBar from './components/NavigationBar'; import HomePageRoutes from './routes/HomePageRoutes'; @@ -15,8 +16,7 @@ import { AbilityContext } from './contexts/Can'; import UserService from './services/UserService'; import ErrorDisplay from './components/ErrorDisplay'; import APIErrorProvider from './contexts/APIErrorContext'; -import ScrollToTop from "./components/ScrollToTop"; -import React from "react"; +import ScrollToTop from './components/ScrollToTop'; export default function App() { if (!UserService.isLoggedIn()) { diff --git a/spiffworkflow-frontend/src/components/ScrollToTop.tsx b/spiffworkflow-frontend/src/components/ScrollToTop.tsx index 01d0b5806..7d8c6f1a6 100644 --- a/spiffworkflow-frontend/src/components/ScrollToTop.tsx +++ b/spiffworkflow-frontend/src/components/ScrollToTop.tsx @@ -1,12 +1,12 @@ -import { useEffect } from "react"; -import { useLocation } from "react-router-dom"; +import { useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; export default function ScrollToTop() { - const { pathname } = useLocation(); + const { pathname } = useLocation(); - useEffect(() => { - window.scrollTo(0, 0); - }, [pathname]); + useEffect(() => { + window.scrollTo(0, 0); + }, [pathname]); - return null; -} \ No newline at end of file + return null; +}