Skip to content

Commit

Permalink
Backport PR #9189: Update session and kernel manager data only if the…
Browse files Browse the repository at this point in the history
…re was a real change.
  • Loading branch information
ellisonbg authored and meeseeksmachine committed Oct 22, 2020
1 parent bbc2959 commit b8c5203
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 b8c5203

Please sign in to comment.