MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / cacheKernelInfo

Function cacheKernelInfo

src/kernels/kernelInfo.ts:77–96  ·  view source on GitHub ↗
(
    storage: Memento,
    kernelConnection: KernelConnectionMetadata,
    info: KernelMessage.IReplyErrorContent | KernelMessage.IReplyAbortContent | KernelMessage.IInfoReply | undefined
)

Source from the content-addressed store, hash-verified

75}
76
77async function cacheKernelInfo(
78 storage: Memento,
79 kernelConnection: KernelConnectionMetadata,
80 info: KernelMessage.IReplyErrorContent | KernelMessage.IReplyAbortContent | KernelMessage.IInfoReply | undefined
81) {
82 if (!info || !isRemoteConnection(kernelConnection)) {
83 return;
84 }
85 const kernelInfos = storage
86 .get<CachedKernelInfo[]>(KEY, [])
87 .filter((item) => Date.now() - item.age < CACHE_EXPIRY_IN_MS)
88 .filter((item) => item.id !== kernelConnection.id);
89 kernelInfos.push({
90 id: kernelConnection.id,
91 age: Date.now(),
92 info
93 });
94
95 await storage.update(KEY, kernelInfos);
96}
97function getCacheKernelInfo(storage: Memento, kernelConnection: KernelConnectionMetadata) {
98 if (!isRemoteConnection(kernelConnection)) {
99 return;

Callers 1

getKernelInfoFunction · 0.85

Calls 5

isRemoteConnectionFunction · 0.90
filterMethod · 0.80
getMethod · 0.65
pushMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected