MM-53747: Create job to encode older image paths (#24073)

Bifrost now encodes all image paths. Due to this
one-way translation, we need to encode all the older
image paths as well.

After this is done, we can remove the double-lookup.

https://mattermost.atlassian.net/browse/MM-53747

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Agniva De Sarker
2023-07-25 08:38:35 +05:30
коммит произвёл GitHub
родитель 065d3c3f6b
Коммит 6d6e589c11
14 изменённых файлов: 399 добавлений и 28 удалений

Просмотреть файл

@@ -691,9 +691,10 @@ func (fs SqlFileInfoStore) CountAll() (int64, error) {
return count, nil
}
func (fs SqlFileInfoStore) GetFilesBatchForIndexing(startTime int64, startFileID string, limit int) ([]*model.FileForIndexing, error) {
func (fs SqlFileInfoStore) GetFilesBatchForIndexing(startTime int64, startFileID string, includeDeleted bool, limit int) ([]*model.FileForIndexing, error) {
files := []*model.FileForIndexing{}
sql, args, _ := fs.getQueryBuilder().
query := fs.getQueryBuilder().
Select(fs.queryFields...).
From("FileInfo").
Where(sq.Or{
@@ -704,10 +705,13 @@ func (fs SqlFileInfoStore) GetFilesBatchForIndexing(startTime int64, startFileID
},
}).
OrderBy("FileInfo.CreateAt ASC, FileInfo.Id ASC").
Limit(uint64(limit)).
ToSql()
Limit(uint64(limit))
err := fs.GetSearchReplicaX().Select(&files, sql, args...)
if !includeDeleted {
query = query.Where(sq.Eq{"FileInfo.DeleteAt": 0})
}
err := fs.GetSearchReplicaX().SelectBuilder(&files, query)
if err != nil {
return nil, errors.Wrap(err, "failed to find Files")
}