fix: cells not found
- change: disable log health check websocket Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
79a76f5c3e
commit
244a234833
2 changed files with 14 additions and 7 deletions
|
|
@ -4,18 +4,18 @@ import { lastRequestSheetPrice } from '../stores/recipeStore';
|
||||||
export interface PayloadFromSheet {
|
export interface PayloadFromSheet {
|
||||||
header: string[];
|
header: string[];
|
||||||
key: string;
|
key: string;
|
||||||
payload: GristCell[];
|
payload?: GristCell[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GristCell {
|
export interface GristCell {
|
||||||
cells: {
|
cells?: {
|
||||||
coord: {
|
coord: {
|
||||||
col: number;
|
col: number;
|
||||||
row: number;
|
row: number;
|
||||||
};
|
};
|
||||||
value: string;
|
value: string;
|
||||||
}[];
|
}[];
|
||||||
row_index: number;
|
row_index?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRICE_SHEET_DEFINITION_BY_COUNTRY: any = {
|
const PRICE_SHEET_DEFINITION_BY_COUNTRY: any = {
|
||||||
|
|
@ -53,9 +53,13 @@ export function handleSheetResponseFromNoti(raw_payload: any, ref: string, count
|
||||||
let price_rows = c.payload;
|
let price_rows = c.payload;
|
||||||
// get last because last row will always override
|
// get last because last row will always override
|
||||||
let expected_row = price_rows[price_rows.length - 1];
|
let expected_row = price_rows[price_rows.length - 1];
|
||||||
let price_col = expected_row.cells[price_idx];
|
if (expected_row.cells != undefined) {
|
||||||
products[curr_product_code] = price_col;
|
let price_col = expected_row.cells[price_idx];
|
||||||
console.log(`[handleSheetPrice][country] ${curr_product_code} --> ${price_col}`);
|
products[curr_product_code] = price_col;
|
||||||
|
console.log(`[handleSheetPrice][country] ${curr_product_code} --> ${price_col}`);
|
||||||
|
} else {
|
||||||
|
console.log(`[handleSheetPrice][country] ${curr_product_code} not found cell`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastRequestSheetInstance[country ?? 'unknown'] = products;
|
lastRequestSheetInstance[country ?? 'unknown'] = products;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { permission } from './permissions';
|
||||||
|
|
||||||
let socket: WebSocket | null = null;
|
let socket: WebSocket | null = null;
|
||||||
let reconnectTimeout: any;
|
let reconnectTimeout: any;
|
||||||
|
let socketCheck: any;
|
||||||
const ENABLE_WS_DEBUG: boolean = false;
|
const ENABLE_WS_DEBUG: boolean = false;
|
||||||
|
|
||||||
export const socketConnectionOfflineCount = writable<number>(0);
|
export const socketConnectionOfflineCount = writable<number>(0);
|
||||||
|
|
@ -55,7 +56,7 @@ export function connectToWebsocket(id_token?: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// heartbeat 10s
|
// heartbeat 10s
|
||||||
setInterval(() => {
|
socketCheck = setInterval(() => {
|
||||||
if (get(socketAlreadySendHeartbeat) > 0) {
|
if (get(socketAlreadySendHeartbeat) > 0) {
|
||||||
let heartbeat_may_offline_count = get(socketConnectionOfflineCount);
|
let heartbeat_may_offline_count = get(socketConnectionOfflineCount);
|
||||||
|
|
||||||
|
|
@ -103,6 +104,8 @@ export function connectToWebsocket(id_token?: string) {
|
||||||
socketStore.set(null);
|
socketStore.set(null);
|
||||||
socket = null;
|
socket = null;
|
||||||
|
|
||||||
|
clearInterval(socketCheck);
|
||||||
|
|
||||||
if (auth.currentUser && !socket) {
|
if (auth.currentUser && !socket) {
|
||||||
console.log('try reconnect websocket ...');
|
console.log('try reconnect websocket ...');
|
||||||
// retry again
|
// retry again
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue