@ -29,7 +29,7 @@ mod live;
mod context ;
mod job ;
// test
// This is a test function, when we have a real job server, remove it.
async fn do_thing_every ( ) -> Result < ( mpsc ::Sender < ( ) > , task ::JoinHandle < ( ) > ) , Box < dyn std ::error ::Error > >
{
let mut interval = time ::interval ( Duration ::from_secs ( 10 ) ) ;
@ -40,7 +40,7 @@ async fn do_thing_every() -> Result<(mpsc::Sender<()>, task::JoinHandle<()>), Bo
println! ( "starting?" ) ;
loop {
let mut tick = interval . tick ( ) ;
let tick = interval . tick ( ) ;
tokio ::pin ! ( tick ) ;
loop {
select ! {
@ -49,7 +49,7 @@ async fn do_thing_every() -> Result<(mpsc::Sender<()>, task::JoinHandle<()>), Bo
println! ( "yes" ) ;
break ;
}
command = rx . recv ( ) = > {
_ command = rx . recv ( ) = > {
// We got interrupt, interpret `command` here.
// `continue` to continue waiting on this interval, break to go to next, return to stop
println! ( "no" ) ;
@ -65,17 +65,40 @@ async fn do_thing_every() -> Result<(mpsc::Sender<()>, task::JoinHandle<()>), Bo
fn print_stats ( )
{
use recolored ::Colorize ;
lazy_static ! {
static ref AUTHORS : String = env! ( "CARGO_PKG_AUTHORS" ) . replace ( ":" , ", " ) ;
} ;
status ! ( "This is the lolicron daemon version {} by {}" , env! ( "CARGO_PKG_VERSION" ) , & AUTHORS [ .. ] ) ;
#[ cfg(debug_assertions) ]
lazy_static ! {
static ref BUILD_IDENT : recolored ::ColoredString = "debug" . bright_blue ( ) ;
}
#[ cfg(not(debug_assertions)) ]
lazy_static ! {
static ref BUILD_IDENT : recolored ::ColoredString = "release" . bright_red ( ) ;
}
use std ::ops ::Deref ;
status ! ( "This is the lolicron daemon version {} by {} ({} build)" , env! ( "CARGO_PKG_VERSION" ) , & AUTHORS [ .. ] , BUILD_IDENT . deref ( ) ) ;
status ! ( "---" ) ;
status ! ( "Compiled with:" ) ;
#[ cfg(nightly) ] status ! ( " +nightly" ) ;
#[ cfg(debug_assertions) ] status ! ( " +debug_assertions" ) ;
status ! ( "Compiled with ({}, {}, {}, {}):" , "on" . bright_red ( ) , "default on" . red ( ) , "off" . bright_blue ( ) , "default off" . blue ( ) ) ;
#[ cfg(nightly) ] status ! ( " +nightly" . bright_red ( ) ) ;
#[ cfg(debug_assertions) ] status ! ( " +debug_assertions" . red ( ) ) ;
status ! ( "features:" ) ;
#[ cfg(feature= " threaded " ) ] status ! ( " +threaded" ) ;
#[ cfg(feature= " threaded " ) ] status ! ( " +threaded" . red ( ) ) ;
#[ cfg(not(feature= " threaded " )) ] status ! ( " -threaded" . bright_blue ( ) ) ;
#[ cfg(feature= " watcher_unlimited " ) ] status ! ( " +watcher_unlimited" . bright_red ( ) ) ;
#[ cfg(not(feature= " watcher_unlimited " )) ] status ! ( " -watcher_unlimited" . blue ( ) ) ;
#[ cfg(feature= " watcher_timeout " ) ] status ! ( " +watcher_timeout" . red ( ) ) ;
#[ cfg(not(feature= " watcher_timeout " )) ] status ! ( " -watcher_timeout" . bright_blue ( ) ) ;
status ! ( "" ) ;
status ! ( "GPl'd with <3" ) ;
status ! ( "Please enjoy" ) ;
@ -94,7 +117,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let oneesan = live ::watch ( "." ) ;
{
let mut recv = oneesan . hook ( " main.rs", live ::filter ::ALL ) . await ;
let mut recv = oneesan . hook ( " src/ main.rs", live ::filter ::ALL ) . await ;
while let Some ( event ) = recv . recv ( ) . await
{
important ! ( "Got ev {:?}" , event ) ;