1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Demonstrates the opt-in `/session/heartbeat` background task. By default
//! Snowflake idles a session out after ~4h; for long-lived dashboard apps
//! that hold a `SnowflakeApi` across a process lifetime, enabling
//! `with_keep_alive` keeps the cached session token valid.
//!
//! Run with a short interval to see the heartbeat fire repeatedly:
//!
//! ```text
//! RUST_LOG=info,firn=debug \
//! cargo run --example keep_alive
//! ```
//!
//! The first `exec` triggers login. Subsequent heartbeats keep the session
//! alive while `tokio::time::sleep` simulates a quiet dashboard. The task
//! is aborted when `api` is dropped at the end of `main`.
extern crate firn;
use Duration;
use Result;
use ;
async