Compare commits
7 Commits
release/20
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a182ea0869 | ||
|
|
d92bab113e | ||
|
|
93c6e2b601 | ||
|
|
19a90571f6 | ||
|
|
953e70efef | ||
|
|
17285fc029 | ||
|
|
401e3cff73 |
@@ -1,45 +0,0 @@
|
||||
#Elastic Beanstalk Nginx Configuration File
|
||||
|
||||
user nginx;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
worker_processes auto;
|
||||
worker_rlimit_nofile 200000;
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
}
|
||||
|
||||
http {
|
||||
server_tokens off;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
include conf.d/*.conf;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default "upgrade";
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
client_max_body_size 50M;
|
||||
client_body_buffer_size 5M;
|
||||
client_header_timeout 60;
|
||||
client_body_timeout 60;
|
||||
keepalive_timeout 60;
|
||||
gzip off;
|
||||
gzip_comp_level 4;
|
||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml>
|
||||
|
||||
# Include the Elastic Beanstalk generated locations
|
||||
include conf.d/elasticbeanstalk/*.conf;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
Typography
|
||||
} from "antd";
|
||||
import Dinero from "dinero.js";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -24,14 +23,14 @@ import i18n from "../../translations/i18n";
|
||||
import dayjs from "../../utils/day";
|
||||
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
||||
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
const mapDispatchToProps = () => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
|
||||
@@ -93,7 +92,9 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
||||
})
|
||||
: ""
|
||||
}`.slice(0, 239),
|
||||
inservicedate: dayjs("2019-01-01")
|
||||
inservicedate: dayjs(
|
||||
`${(job.v_model_yr && (job.v_model_yr < 100 ? (job.v_model_yr >= (dayjs().year() + 1) % 100 ? 1900 + parseInt(job.v_model_yr) : 2000 + parseInt(job.v_model_yr)) : job.v_model_yr)) || 2019}-01-01`
|
||||
)
|
||||
}}
|
||||
>
|
||||
<LayoutFormRow grow>
|
||||
|
||||
@@ -32,7 +32,6 @@ const SocketProvider = ({ children, bodyshop, navigate, currentUser }) => {
|
||||
const socketRef = useRef(null);
|
||||
const [clientId, setClientId] = useState(null);
|
||||
const [isConnected, setIsConnected] = useState(false);
|
||||
const [socketInitialized, setSocketInitialized] = useState(false);
|
||||
const notification = useNotification();
|
||||
const userAssociationId = bodyshop?.associations?.[0]?.id;
|
||||
const { t } = useTranslation();
|
||||
@@ -148,13 +147,6 @@ const SocketProvider = ({ children, bodyshop, navigate, currentUser }) => {
|
||||
onError: (err) => console.error("MARK_ALL_NOTIFICATIONS_READ error:", err)
|
||||
});
|
||||
|
||||
const checkAndReconnect = () => {
|
||||
if (socketRef.current && !socketRef.current.connected) {
|
||||
console.log("Attempting manual reconnect due to event trigger");
|
||||
socketRef.current.connect();
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const initializeSocket = async (token) => {
|
||||
if (!bodyshop || !bodyshop.id || socketRef.current) return;
|
||||
@@ -166,14 +158,13 @@ const SocketProvider = ({ children, bodyshop, navigate, currentUser }) => {
|
||||
auth: { token, bodyshopId: bodyshop.id },
|
||||
reconnectionAttempts: Infinity,
|
||||
reconnectionDelay: 2000,
|
||||
reconnectionDelayMax: 60000,
|
||||
randomizationFactor: 0.5,
|
||||
transports: ["websocket", "polling"], // Add this to prefer WebSocket with polling fallback
|
||||
rememberUpgrade: true
|
||||
reconnectionDelayMax: 60000
|
||||
// randomizationFactor: 0.5,
|
||||
// transports: ["websocket", "polling"], // Add this to prefer WebSocket with polling fallback
|
||||
// rememberUpgrade: true
|
||||
});
|
||||
|
||||
socketRef.current = socketInstance;
|
||||
setSocketInitialized(true);
|
||||
|
||||
const handleBodyshopMessage = (message) => {
|
||||
if (!message || !message.type) return;
|
||||
@@ -261,7 +252,7 @@ const SocketProvider = ({ children, bodyshop, navigate, currentUser }) => {
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleConnect = () => {
|
||||
socketInstance.emit("join-bodyshop-room", bodyshop.id);
|
||||
setClientId(socketInstance.id);
|
||||
@@ -558,57 +549,6 @@ const SocketProvider = ({ children, bodyshop, navigate, currentUser }) => {
|
||||
t
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!socketInitialized) return;
|
||||
|
||||
const onVisibilityChange = () => {
|
||||
if (document.visibilityState === "visible") {
|
||||
checkAndReconnect();
|
||||
}
|
||||
};
|
||||
|
||||
const onFocus = () => {
|
||||
checkAndReconnect();
|
||||
};
|
||||
|
||||
const onOnline = () => {
|
||||
checkAndReconnect();
|
||||
};
|
||||
|
||||
const onPageShow = (event) => {
|
||||
if (event.persisted) {
|
||||
checkAndReconnect();
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("visibilitychange", onVisibilityChange);
|
||||
window.addEventListener("focus", onFocus);
|
||||
window.addEventListener("online", onOnline);
|
||||
window.addEventListener("pageshow", onPageShow);
|
||||
|
||||
// Sleep/wake detection using timer
|
||||
let lastTime = Date.now();
|
||||
const intervalMs = 1000; // Check every second
|
||||
const thresholdMs = 2000; // If more than 2 seconds elapsed, assume sleep/wake
|
||||
|
||||
const sleepCheckInterval = setInterval(() => {
|
||||
const currentTime = Date.now();
|
||||
if (currentTime > lastTime + intervalMs + thresholdMs) {
|
||||
console.log("Detected potential wake from sleep/hibernate");
|
||||
checkAndReconnect();
|
||||
}
|
||||
lastTime = currentTime;
|
||||
}, intervalMs);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("visibilitychange", onVisibilityChange);
|
||||
window.removeEventListener("focus", onFocus);
|
||||
window.removeEventListener("online", onOnline);
|
||||
window.removeEventListener("pageshow", onPageShow);
|
||||
clearInterval(sleepCheckInterval);
|
||||
};
|
||||
}, [socketInitialized]);
|
||||
|
||||
return (
|
||||
<SocketContext.Provider
|
||||
value={{
|
||||
|
||||
Reference in New Issue
Block a user