1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-08-11 01:41:51 +03:00
parent 45c65610b9
commit b8bde06869
3 changed files with 9 additions and 10 deletions

View File

@ -62,13 +62,10 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
migrations: migrations,
});
if (ipcRenderer) {
ipcRenderer.on("cluster:state", (event, state: ClusterState) => {
ipcRenderer.on("cluster:state", (event, model: ClusterState) => {
this.applyWithoutSync(() => {
logger.debug(`[CLUSTER-STORE]: received push-state at ${location.host}`, state);
const cluster = this.getById(state.id);
if (cluster) {
cluster.updateModel(state)
}
logger.debug(`[CLUSTER-STORE]: received push-state at ${location.host}`, model);
this.getById(model.id)?.updateModel(model);
})
})
}

View File

@ -24,7 +24,7 @@ export interface IpcChannelResponse<T extends any[] = any, E = any> {
error?: E;
}
export interface IpcChannelInit {
export interface IpcChannelOptions {
channel: IpcChannel; // main <-> renderer communication channel name
mode?: IpcMode; // default: "async", use "sync" as last resort: https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendsyncchannel-args
handle?: (...args: any[]) => any; // main-process message handler
@ -33,7 +33,7 @@ export interface IpcChannelInit {
once?: boolean; // todo: add support
}
export function createIpcChannel({ autoBind = true, mode = IpcMode.ASYNC, timeout = 0, handle, channel }: IpcChannelInit) {
export function createIpcChannel({ autoBind = true, mode = IpcMode.ASYNC, timeout = 0, handle, channel }: IpcChannelOptions) {
channel = `${mode}:${channel}`
const ipcChannel = {

View File

@ -16,8 +16,10 @@ class MetricsRoute extends LensApi {
let prometheusPath: string
let prometheusProvider: PrometheusProvider
try {
prometheusPath = await cluster.contextHandler.getPrometheusPath()
prometheusProvider = await cluster.contextHandler.getPrometheusProvider()
[prometheusPath, prometheusProvider] = await Promise.all([
cluster.contextHandler.getPrometheusPath(),
cluster.contextHandler.getPrometheusProvider()
])
} catch {
this.respondJson(response, {})
return