canary/canary.node.tsx

69 lines
1.6 KiB
TypeScript

/** @jsx $mol_jsx */
namespace $ {
$hyoo_crus_yard.masters = [
"http://localhost:9090/"
// "http://127.0.0.1:9090/"
// $mol_dom_context.document.location.origin +'/',
]
// используем hyoo_crus_app_node чтобы сразу иметь крас ноду
export class $hd_canary extends $hyoo_crus_app_node {
@ $mol_mem
_stat_update() {
// console.log("asdddddddd")
this.$.$mol_log3_done({
place: this,
message: "_stat_update",
...{action:"tick", url: "_stat_update", title: "_stat_update" }
});
const home_land = this.$.$hyoo_crus_glob.home().land()
const list = home_land.Node( $hd_canary_app_server ).Item('').Users(null)!
for (const ref of list.items()) {
try {
const user = this.$.$hyoo_crus_glob.Node((ref as $hyoo_crus_ref), $hd_canary_app_home )
for (const site of user.Sites(null)?.remote_list() ?? []) {
site.tick()
}
} catch( error ) {
$mol_fail_log( error )
continue;
}
}
}
@ $mol_memo.method
join() {
return new $hd_canary_join
}
}
export class $hd_canary_join extends $mol_rest_resource {
GET( msg: $mol_rest_message ) {
const home_land = this.$.$hyoo_crus_glob.home().land()
home_land.give(null, $hyoo_crus_rank_rule)
const list = home_land.Node( $hd_canary_app_server ).Item('')
// const home_land = this.$.$hyoo_crus_glob.home( $hd_canary_app_home_server ).land()
// home_land.give(null, $hyoo_crus_rank_rule)
msg.reply( list.ref().description! )
}
}
}
$.$hd_canary.serve()
/*
npm start
+ hd/canary port=9090
*/