Skip to content

Commit

Permalink
docs: minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Oct 10, 2024
1 parent e3fc400 commit 82cb3c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ checks:
weekdays:
timezone: "America/New_York"
times:
- at: "14:00"
tolerance: "5m"
- "14:00"
# Only allow check-ins between 13:55 and 14:05
tolerance: "5m"

- id: "5pm-close"
name: "Close out for the day"
schedule:
bankingDays:
timezone: "America/New_York"
times:
- at: "17:00"
tolerance: "5m"
- "17:00"
# Only allow check-ins between 16:55 and 17:05
tolerance: "5m"

# Global alert configuration
alert:
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ checks:
schedule:
weekdays:
timezone: "America/New_York"
times: ["17:00"]
times: ["14:00"]
# Only allow check-ins between 13:55 and 14:05
tolerance: "5m"

# - id: "5pm-close"
Expand Down
10 changes: 10 additions & 0 deletions pkg/deadcheck/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ type CheckInResponse struct {
NextExpectedCheckIn time.Time `json:"nextExpectedCheckIn"`
}

// CheckIn updates the specified check's next expected alert time by extending it to the next scheduled interval.
// This function is typically called after an operation successfully completes. For example, after files are uploaded.
//
// Example usage:
//
// response, err := client.CheckIn(ctx, "2pm-checkin")
// if err != nil {
// log.Fatalf("Failed to check in: %v", err)
// }
// log.Printf("Check-in successful: next check-in expected by %v", response.NextExpectedCheckIn)
func (c *client) CheckIn(ctx context.Context, checkID string) (*CheckInResponse, error) {
address, err := c.getAddress(fmt.Sprintf("/checks/%s/check-in", checkID))
if err != nil {
Expand Down

0 comments on commit 82cb3c4

Please sign in to comment.