I want to poll a parameter in the canister, and perform some other operations when there are other methods that change the current parameter. At present, the way I think of is the following code
let START = false;
loop {
if START {
// do some stuff
} else {
// wait
let end_time = ic_cdk::api::time() + 1000000000; // one second interval
loop {
let current_time = ic_cdk::api::time();
if current_time > end_time {
break;
}
}
}
}
Is there any better way