NTP-21297 | Ignoring some team ids from being set to Investigating after 30 days (#468)
This commit is contained in:
@@ -99,4 +99,5 @@ jira.link.max.length=JIRA_LINK_MAX_LENGTH
|
||||
investigation.reopen.threshold.days=INVESTIGATION_REOPEN_THRESHOLD_DAYS
|
||||
archival.batch.interval.in.seconds=70
|
||||
slack.api.tier3.batch.size=90
|
||||
slack.api.get.users.in.conversation.interval.in.seconds=70
|
||||
slack.api.get.users.in.conversation.interval.in.seconds=70
|
||||
investigation.reopen.ignore.team_ids=INVESTIGATION_REOPEN_IGNORE_TEAM_IDS
|
||||
@@ -563,11 +563,20 @@ func (r *Repository) GetIncidentsForEscalation() ([]IncidentEntity, error) {
|
||||
|
||||
func (r *Repository) GetIncidentsForMovingToInvestigating() ([]IncidentEntity, error) {
|
||||
var incidentEntities []IncidentEntity
|
||||
rawTeamIDs := viper.GetString("investigation.reopen.ignore.team_ids")
|
||||
var teamIDsToIgnore []int
|
||||
for _, str := range strings.Split(rawTeamIDs, ",") {
|
||||
teamID, err := strconv.Atoi(strings.TrimSpace(str))
|
||||
if err != nil {
|
||||
logger.Error(fmt.Sprintf("Error converting value to integer: %v", err))
|
||||
}
|
||||
teamIDsToIgnore = append(teamIDsToIgnore, teamID)
|
||||
}
|
||||
|
||||
incidentInvestigationReopenDays := viper.GetInt("investigation.reopen.threshold.days")
|
||||
dateBefore := time.Now().AddDate(0, 0, -incidentInvestigationReopenDays).Format(time.RFC3339)
|
||||
|
||||
result := r.gormClient.Raw(incidentsToMoveToInvestigating, dateBefore).Scan(&incidentEntities)
|
||||
result := r.gormClient.Raw(incidentsToMoveToInvestigating, teamIDsToIgnore, dateBefore).Scan(&incidentEntities)
|
||||
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
@@ -717,7 +726,7 @@ const incidentsToMoveToInvestigating = `
|
||||
SELECT ists.id
|
||||
FROM incident_status ists
|
||||
WHERE ists.name IN ('Monitoring', 'Identified')
|
||||
)
|
||||
) AND i.team_id NOT IN ?
|
||||
),
|
||||
max_log_entries AS (
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user