(
storage: Memento,
kernelConnection: KernelConnectionMetadata,
info: KernelMessage.IReplyErrorContent | KernelMessage.IReplyAbortContent | KernelMessage.IInfoReply | undefined
)
| 75 | } |
| 76 | |
| 77 | async 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 | } |
| 97 | function getCacheKernelInfo(storage: Memento, kernelConnection: KernelConnectionMetadata) { |
| 98 | if (!isRemoteConnection(kernelConnection)) { |
| 99 | return; |
no test coverage detected