Skip to content

Commit

Permalink
tweak bot check interval
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Sep 5, 2024
1 parent 0f0fa7a commit bab69ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
2.6.0
6 changes: 4 additions & 2 deletions frontend/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { create } from "zustand";

export const recently = 1000 * 60 * 15;
export const recently = 1000 * 60 * 50;

function isOnline(lastSync: Date, lastSeen?: Date): boolean {
if (!lastSeen) return false;
Expand Down Expand Up @@ -118,7 +118,9 @@ export const useStore = create<State>()((set) => ({
if (online1 > online2) {
return -1;
}
if ((b1.name || b1.addr) < (b2.name || b2.addr)) {
const name1 = (b1.name || b1.addr).toLowerCase();
const name2 = (b2.name || b2.addr).toLowerCase();
if (name1 < name2) {
return -1;
}
return 1;
Expand Down
10 changes: 5 additions & 5 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func onBotStart(cli *botcli.BotCli, bot *deltachat.Bot, cmd *cobra.Command, args

func updateOfflineBotsStatusLoop(rpc *deltachat.Rpc) {
logger := cli.Logger.With("origin", "off-bots-status-loop")
delay := 60 * time.Minute
delay := 120 * time.Minute
for {
toSleep := delay - time.Since(cfg.OffLastChecked)
if toSleep > 0 {
Expand Down Expand Up @@ -94,7 +94,7 @@ func updateOfflineBotsStatusLoop(rpc *deltachat.Rpc) {
logger.Error(err)
continue
}
if time.Since(contact.LastSeen.Time).Minutes() < 30 {
if time.Since(contact.LastSeen.Time).Minutes() < 60 {
// bot is not offline, it will be checked by the online-bots status loop
continue
}
Expand All @@ -108,7 +108,7 @@ func updateOfflineBotsStatusLoop(rpc *deltachat.Rpc) {

func updateStatusLoop(rpc *deltachat.Rpc) {
logger := cli.Logger.With("origin", "status-loop")
delay := 10 * time.Minute
delay := 30 * time.Minute
for {
toSleep := delay - time.Since(cfg.StatusLastChecked)
if toSleep > 0 {
Expand All @@ -122,7 +122,7 @@ func updateStatusLoop(rpc *deltachat.Rpc) {
if botsData.Hash == "" {
delay = 10 * time.Second
} else {
delay = 10 * time.Minute
delay = 30 * time.Minute
}
selfAddrs := getSelfAddrs(rpc)
accId := getFirstAccount(rpc)
Expand Down Expand Up @@ -151,7 +151,7 @@ func updateStatusLoop(rpc *deltachat.Rpc) {
logger.Error(err)
continue
}
if time.Since(contact.LastSeen.Time).Minutes() >= 30 {
if time.Since(contact.LastSeen.Time).Minutes() >= 60 {
// offline bot, will be check by the offline-bots status loop
continue
}
Expand Down

0 comments on commit bab69ce

Please sign in to comment.