shouldCheckUpdate checks if update should be checked
(ctx context.DnoteCtx)
| 34 | |
| 35 | // shouldCheckUpdate checks if update should be checked |
| 36 | func shouldCheckUpdate(ctx context.DnoteCtx) (bool, error) { |
| 37 | db := ctx.DB |
| 38 | |
| 39 | var lastUpgrade int64 |
| 40 | err := db.QueryRow("SELECT value FROM system WHERE key = ?", consts.SystemLastUpgrade).Scan(&lastUpgrade) |
| 41 | if err != nil { |
| 42 | return false, errors.Wrap(err, "getting last_udpate") |
| 43 | } |
| 44 | |
| 45 | now := time.Now().Unix() |
| 46 | |
| 47 | return now-lastUpgrade > upgradeInterval, nil |
| 48 | } |
| 49 | |
| 50 | func touchLastUpgrade(ctx context.DnoteCtx) error { |
| 51 | db := ctx.DB |