Agents Table
so i made /agents and it displays the online agents in a nice table!
i used the shadcn table component to make that, it fetches /agents/ on backend every 10 seconds and gets the data ofc handling with the goat tanstack query.
one stupid thing i encountered was the fact that i was not handling the agent status in backend properly, once it turned online it forever stays online so i went to work on that first and found out that its lowk not a good idea to update and store the online/offline status on database, better way would be to just use last_seen and check if the agent’s last heartbeat was more than 2 minutes ago, if thats true just make the json data display “offline” in /agents endpoint, ez.
i will ofc add more status types so i will handle it in a better way, but thats in future.
and one more stupid thing i came across, and boy call me an idiot cuz i was PULLING my hair trying to figure out why the table wont update even after the backend endpoint is giving correct status, i thought so many things like cache and shit 😭️ and after like 20 minutes i saw that instead of refetch_interval: 10000 which is 10 seconds, i accidently made a typo and set it to 100000 which is 100 seconds 😭️
well it works now, and works good.
next: event storage setup probably?
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.