func checkLicensesIfNeeded(client slackClient) {
	c := redispool.Store.Get()
	defer func() { _ = c.Close() }()

	today := time.Now().UTC().Format("2006-01-02")

	lastCheckDate, err := redis.String(c.Do("GETSET", lastLicenseExpirationCheckKey, today))
	if err == redis.ErrNil {
		// If the redis key hasn't been set yet, do so and leave lastCheckDate as nil
		_, setErr := c.Do("SET", lastLicenseExpirationCheckKey, today)
		if setErr != nil {
			log15.Error("startCheckForUpcomingLicenseExpirations: error SET last license expiration check date", "error", err)
			return
		}
	} else if err != nil {
		log15.Error("startCheckForUpcomingLicenseExpirations: error GETSET last license expiration check date", "error", err)
		return
	}

	if today != lastCheckDate {
		checkForUpcomingLicenseExpirations(glock.NewRealClock(), client)
	}
}
// checkLicensesIfNeeded checks whether a day has passed since the last license check, and if so, initiates one.
checkLicensesIfNeeded checks whether a day has passed since the last license check, and if so, initiates one.
// checkLicensesIfNeeded checks whether a day has passed since the last license check and if so initiates one .
func checkLicensesIfNeeded(client slackClient) {
	c := redispool.Store.Get()
	defer func() { _ = c.Close() }()
	today := time.Now().UTC().Format("2006-01-02")
	lastCheckDate, err := redis.String(c.Do("GETSET", lastLicenseExpirationCheckKey, today))
	if err == redis.ErrNil {
		_, setErr := c.Do("SET", lastLicenseExpirationCheckKey, today)
		if setErr != nil {
			log15.Error("startCheckForUpcomingLicenseExpirations: error SET last license expiration check date", "error", err)
			return
		}
	} else if err != nil {
		log15.Error("startCheckForUpcomingLicenseExpirations: error GETSET last license expiration check date", "error", err)
		return
	}
	if today != lastCheckDate {
		checkForUpcomingLicenseExpirations(glock.NewRealClock(), client)
	}
}
func checkLicensesIfNeeded ( client slackClient ) { c := redispool . Store . Get ( ) defer func ( ) { _ = c . Close ( ) } ( ) today := time . Now ( ) . UTC ( ) . Format ( " " ) lastCheckDate , err := redis . String ( c . Do ( " " , lastLicenseExpirationCheckKey , today ) ) if err == redis . ErrNil { _ , setErr := c . Do ( " " , lastLicenseExpirationCheckKey , today ) if setErr != nil { log15 . Error ( " " , " " , err ) return } } else if err != nil { log15 . Error ( " " , " " , err ) return } if today != lastCheckDate { checkForUpcomingLicenseExpirations ( glock . NewRealClock ( ) , client ) } }
checkLicensesIfNeeded checks whether a day has passed since the last license check, and if so, initiates one.
checkLicensesIfNeeded checks whether a day has passed since the last license check and if so initiates one .
// If the redis key hasn't been set yet, do so and leave lastCheckDate as nil