vitess.io/vitess@v0.16.2/go/vt/vttablet/tabletserver/throttle/base/recent_app.go (about)

     1  /*
     2   Copyright 2017 GitHub Inc.
     3  
     4   Licensed under MIT License. See https://github.com/github/freno/blob/master/LICENSE
     5  */
     6  
     7  package base
     8  
     9  import (
    10  	"time"
    11  )
    12  
    13  // RecentApp indicates when an app was last checked
    14  type RecentApp struct {
    15  	CheckedAtEpoch      int64
    16  	MinutesSinceChecked int64
    17  }
    18  
    19  // NewRecentApp creates a RecentApp
    20  func NewRecentApp(checkedAt time.Time) *RecentApp {
    21  	result := &RecentApp{
    22  		CheckedAtEpoch:      checkedAt.Unix(),
    23  		MinutesSinceChecked: int64(time.Since(checkedAt).Minutes()),
    24  	}
    25  	return result
    26  }