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 {
|
||||
header: string[];
|
||||
key: string;
|
||||
payload: GristCell[];
|
||||
payload?: GristCell[];
|
||||
}
|
||||
|
||||
export interface GristCell {
|
||||
cells: {
|
||||
cells?: {
|
||||
coord: {
|
||||
col: number;
|
||||
row: number;
|
||||
};
|
||||
value: string;
|
||||
}[];
|
||||
row_index: number;
|
||||
row_index?: number;
|
||||
}
|
||||
|
||||
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;
|
||||
// get last because last row will always override
|
||||
let expected_row = price_rows[price_rows.length - 1];
|
||||
let price_col = expected_row.cells[price_idx];
|
||||
products[curr_product_code] = price_col;
|
||||
console.log(`[handleSheetPrice][country] ${curr_product_code} --> ${price_col}`);
|
||||
if (expected_row.cells != undefined) {
|
||||
let price_col = expected_row.cells[price_idx];
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { permission } from './permissions';
|
|||
|
||||
let socket: WebSocket | null = null;
|
||||
let reconnectTimeout: any;
|
||||
let socketCheck: any;
|
||||
const ENABLE_WS_DEBUG: boolean = false;
|
||||
|
||||
export const socketConnectionOfflineCount = writable<number>(0);
|
||||
|
|
@ -55,7 +56,7 @@ export function connectToWebsocket(id_token?: string) {
|
|||
}
|
||||
|
||||
// heartbeat 10s
|
||||
setInterval(() => {
|
||||
socketCheck = setInterval(() => {
|
||||
if (get(socketAlreadySendHeartbeat) > 0) {
|
||||
let heartbeat_may_offline_count = get(socketConnectionOfflineCount);
|
||||
|
||||
|
|
@ -103,6 +104,8 @@ export function connectToWebsocket(id_token?: string) {
|
|||
socketStore.set(null);
|
||||
socket = null;
|
||||
|
||||
clearInterval(socketCheck);
|
||||
|
||||
if (auth.currentUser && !socket) {
|
||||
console.log('try reconnect websocket ...');
|
||||
// retry again
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue