summaryrefslogtreecommitdiffstats
path: root/model/job.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-08-17 15:05:17 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-17 10:05:17 -0400
commit22459ee17a3ba0b4487f975b6ebe630cab2d9feb (patch)
tree275d8b68561d1c5046416d04264efc35806b8342 /model/job.go
parent4e92d1801733410c47bdde29c4bda4d52210d4e7 (diff)
downloadchat-22459ee17a3ba0b4487f975b6ebe630cab2d9feb.tar.gz
chat-22459ee17a3ba0b4487f975b6ebe630cab2d9feb.tar.bz2
chat-22459ee17a3ba0b4487f975b6ebe630cab2d9feb.zip
PLT-7302: Aggregate Elasticsearch indexes over a certain age. (#7224)
* PLT-7302: Aggregate Elasticsearch indexes over a certain age. This is done by a scheduled daily job, in order to keep the shard count to a sensible level in Elasticsearch. * Use map[string]string instead of StringMap
Diffstat (limited to 'model/job.go')
-rw-r--r--model/job.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/model/job.go b/model/job.go
index 004331a1f..258fa2bd3 100644
--- a/model/job.go
+++ b/model/job.go
@@ -10,8 +10,9 @@ import (
)
const (
- JOB_TYPE_DATA_RETENTION = "data_retention"
- JOB_TYPE_ELASTICSEARCH_POST_INDEXING = "elasticsearch_post_indexing"
+ JOB_TYPE_DATA_RETENTION = "data_retention"
+ JOB_TYPE_ELASTICSEARCH_POST_INDEXING = "elasticsearch_post_indexing"
+ JOB_TYPE_ELASTICSEARCH_POST_AGGREGATION = "elasticsearch_post_aggregation"
JOB_STATUS_PENDING = "pending"
JOB_STATUS_IN_PROGRESS = "in_progress"
@@ -22,15 +23,15 @@ const (
)
type Job struct {
- Id string `json:"id"`
- Type string `json:"type"`
- Priority int64 `json:"priority"`
- CreateAt int64 `json:"create_at"`
- StartAt int64 `json:"start_at"`
- LastActivityAt int64 `json:"last_activity_at"`
- Status string `json:"status"`
- Progress int64 `json:"progress"`
- Data map[string]interface{} `json:"data"`
+ Id string `json:"id"`
+ Type string `json:"type"`
+ Priority int64 `json:"priority"`
+ CreateAt int64 `json:"create_at"`
+ StartAt int64 `json:"start_at"`
+ LastActivityAt int64 `json:"last_activity_at"`
+ Status string `json:"status"`
+ Progress int64 `json:"progress"`
+ Data map[string]string `json:"data"`
}
func (j *Job) IsValid() *AppError {
@@ -45,6 +46,7 @@ func (j *Job) IsValid() *AppError {
switch j.Type {
case JOB_TYPE_DATA_RETENTION:
case JOB_TYPE_ELASTICSEARCH_POST_INDEXING:
+ case JOB_TYPE_ELASTICSEARCH_POST_AGGREGATION:
default:
return NewAppError("Job.IsValid", "model.job.is_valid.type.app_error", nil, "id="+j.Id, http.StatusBadRequest)
}