Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #9189 on branch 2.2.x (Update session and kernel manager data only if there was a real change.) #9211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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