Skip to content

Commit

Permalink
Merge pull request #9211 from meeseeksmachine/auto-backport-of-pr-918…
Browse files Browse the repository at this point in the history
…9-on-2.2.x

Backport PR #9189 on branch 2.2.x (Update session and kernel manager data only if there was a real change.)
  • Loading branch information
ajbozarth committed Oct 23, 2020
2 parents 1c7d14e + b8c5203 commit a67a68e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
14 changes: 7 additions & 7 deletions packages/services/src/kernel/manager.ts
Expand Up @@ -2,7 +2,6 @@
// Distributed under the terms of the Modified BSD License.

import { IIterator, iter, every } from '@lumino/algorithm';
import { JSONExt, JSONObject } from '@lumino/coreutils';
import { Poll } from '@lumino/polling';
import { ISignal, Signal } from '@lumino/signaling';

Expand Down Expand Up @@ -257,12 +256,13 @@ export class KernelManager extends BaseManager implements Kernel.IManager {

if (
this._models.size === models.length &&
every(models, x =>
JSONExt.deepEqual(
(this._models.get(x.id) as unknown) as JSONObject,
(x as unknown) as JSONObject
)
)
every(models, x => {
const existing = this._models.get(x.id);
if (!existing) {
return false;
}
return existing.name === x.name;
})
) {
// Identical models list (presuming models does not contain duplicate
// ids), so just return
Expand Down
20 changes: 13 additions & 7 deletions packages/services/src/session/manager.ts
Expand Up @@ -2,7 +2,6 @@
// Distributed under the terms of the Modified BSD License.

import { IIterator, iter, every } from '@lumino/algorithm';
import { JSONExt, JSONObject } from '@lumino/coreutils';
import { Poll } from '@lumino/polling';
import { ISignal, Signal } from '@lumino/signaling';

Expand Down Expand Up @@ -267,12 +266,19 @@ export class SessionManager extends BaseManager implements Session.IManager {

if (
this._models.size === models.length &&
every(models, x =>
JSONExt.deepEqual(
(this._models.get(x.id) as unknown) as JSONObject,
(x as unknown) as JSONObject
)
)
every(models, x => {
const existing = this._models.get(x.id);
if (!existing) {
return false;
}
return (
existing.kernel?.id === x.kernel?.id &&
existing.kernel?.name === x.kernel?.name &&
existing.name === x.name &&
existing.path === x.path &&
existing.type === x.type
);
})
) {
// Identical models list (presuming models does not contain duplicate
// ids), so just return
Expand Down

0 comments on commit a67a68e

Please sign in to comment.