diff --git a/aux/broker b/aux/broker index 0760c6808c..b0d97b1fcb 160000 --- a/aux/broker +++ b/aux/broker @@ -1 +1 @@ -Subproject commit 0760c6808c1d035b7e9f484daefe8ba0a3d6ee13 +Subproject commit b0d97b1fcbdcb9027bd34031c8706be0c0ab315b diff --git a/src/comm/store.bif b/src/comm/store.bif index 7d09704d31..18e63282e8 100644 --- a/src/comm/store.bif +++ b/src/comm/store.bif @@ -108,20 +108,26 @@ function Store::insert%(h: opaque of Store::Handle, auto& key = comm::opaque_field_to_data(k->AsRecordVal(), frame); auto& val = comm::opaque_field_to_data(v->AsRecordVal(), frame); - broker::util::optional expiry; + using broker::store::expiration_time; + broker::util::optional expiry; auto abs_expiry_val = e->AsRecordVal()->Lookup(0); - auto rel_expiry_val = e->AsRecordVal()->Lookup(1); if ( abs_expiry_val ) { - auto tag = broker::store::expiration_time::tag::absolute; - expiry = broker::store::expiration_time(abs_expiry_val->AsTime(), tag); + expiry = expiration_time(abs_expiry_val->AsTime()); + handle->store->insert(key, val, expiry); + return new Val(true, TYPE_BOOL); } - else if ( rel_expiry_val ) + + auto rel_expiry_val = e->AsRecordVal()->Lookup(1); + + if ( rel_expiry_val ) { - auto tag = broker::store::expiration_time::tag::since_last_modification; - expiry = broker::store::expiration_time(rel_expiry_val->AsInterval(), tag); + auto ct = broker::time_point::now().value; + expiry = expiration_time(rel_expiry_val->AsInterval(), ct); + handle->store->insert(key, val, expiry); + return new Val(true, TYPE_BOOL); } handle->store->insert(key, val, expiry);