Merge pull request #611 from kinode-dao/hf/kernel-hold-onto-blobs-until-receive-non-none

kernel: dont replace `last_blob` with None
This commit is contained in:
nick.kino 2024-11-19 18:06:33 -08:00 committed by GitHub
commit 10181710e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 9 deletions

View File

@ -99,7 +99,10 @@ impl process::ProcessState {
ref expects_response,
..
}) => {
self.last_blob = km.lazy_load_blob;
if km.lazy_load_blob.is_some() {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
}
km.lazy_load_blob = None;
if expects_response.is_some() || km.rsvp.is_some() {
// update prompting_message iff there is someone to reply to
@ -109,13 +112,19 @@ impl process::ProcessState {
}
t::Message::Response(_) => match self.contexts.remove(&km.id) {
Some((context, _timeout_handle)) => {
self.last_blob = km.lazy_load_blob;
if km.lazy_load_blob.is_some() {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
}
km.lazy_load_blob = None;
self.prompting_message = context.prompting_message;
(km, context.context)
}
None => {
self.last_blob = km.lazy_load_blob;
if km.lazy_load_blob.is_some() {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
}
km.lazy_load_blob = None;
self.prompting_message = Some(km.clone());
(km, None)

View File

@ -103,8 +103,10 @@ impl process::ProcessState {
ref expects_response,
..
}) => {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
if km.lazy_load_blob.is_some() {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
}
if expects_response.is_some() || km.rsvp.is_some() {
// update prompting_message iff there is someone to reply to
self.prompting_message = Some(km.clone());
@ -113,14 +115,18 @@ impl process::ProcessState {
}
t::Message::Response(_) => match self.contexts.remove(&km.id) {
Some((context, _timeout_handle)) => {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
if km.lazy_load_blob.is_some() {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
}
self.prompting_message = context.prompting_message;
(km, context.context)
}
None => {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
if km.lazy_load_blob.is_some() {
self.last_blob = km.lazy_load_blob;
km.lazy_load_blob = None;
}
self.prompting_message = Some(km.clone());
(km, None)
}