Skip to content

Commit

Permalink
fix(base_node_config): check_interva l is 0 made base node is panicked
Browse files Browse the repository at this point in the history
  • Loading branch information
hnidoaht-101 committed Aug 18, 2022
1 parent 37d38d6 commit afdf169
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base_layer/p2p/src/auto_update/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use std::env::consts;
use std::{env::consts, time::Duration};

use futures::{future::Either, stream, StreamExt};
use log::*;
Expand Down Expand Up @@ -93,7 +93,11 @@ impl SoftwareUpdaterService {
notifier: watch::Sender<Option<SoftwareUpdate>>,
new_update_notification: watch::Receiver<Option<SoftwareUpdate>>,
) {
let mut interval_or_never = match self.config.check_interval {
let mut config_interval = self.config.check_interval;
if Duration::from_secs(self.config.check_interval.unwrap_or_default().as_secs()).is_zero() {
config_interval = None;
}
let mut interval_or_never = match config_interval {
Some(interval) => {
let mut interval = time::interval(interval);
interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
Expand Down

0 comments on commit afdf169

Please sign in to comment.