-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
latentvector
committed
May 2, 2024
1 parent
4b6b991
commit d39c627
Showing
10 changed files
with
306 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import commune as c | ||
|
||
class Watchdog(c.Module): | ||
def __init__(self): | ||
c.thread(self.run_loop) | ||
|
||
def sync(self): | ||
c.print('syncing...') | ||
c.ip(update=1) | ||
c.tree(update=1) | ||
c.namespace(update=1) | ||
c.print('synced') | ||
def run_loop(self, sleep_time=60): | ||
while True: | ||
try: | ||
self.sync() | ||
except Exception as e: | ||
print(e) | ||
pass | ||
c.sleep(sleep_time) | ||
print(f'sleeping for {sleep_time} seconds') |
Oops, something went wrong.