This commit is contained in:
Chris Lu 2021-01-14 23:11:27 -08:00
parent f002e668de
commit 16ad74f477
5 changed files with 7 additions and 7 deletions

View file

@ -203,7 +203,7 @@ func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context,
entries = append(entries, entry) entries = append(entries, entry)
} }
hasMore = int64(len(entries)) == limit + 1 hasMore = int64(len(entries)) == limit+1
if hasMore { if hasMore {
entries = entries[:limit] entries = entries[:limit]
} }

View file

@ -201,7 +201,7 @@ func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, dirPath u
glog.V(0).Infof("list iterator close: %v", err) glog.V(0).Infof("list iterator close: %v", err)
} }
hasMore = int64(len(entries)) == limit + 1 hasMore = int64(len(entries)) == limit+1
if hasMore { if hasMore {
entries = entries[:limit] entries = entries[:limit]
} }

View file

@ -53,7 +53,7 @@ func (f *Filer) doListPatternMatchedEntries(ctx context.Context, p util.FullPath
return return
} }
if len(restNamePattern) == 0 { if len(restNamePattern) == 0 {
return foundEntries, false,0, lastFileName, nil return foundEntries, false, 0, lastFileName, nil
} }
for _, entry := range foundEntries { for _, entry := range foundEntries {
nameToTest := strings.ToLower(entry.Name()) nameToTest := strings.ToLower(entry.Name())

View file

@ -190,7 +190,7 @@ func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, dirPath uti
"$gte": startFileName, "$gte": startFileName,
} }
} }
optLimit := int64(limit+1) optLimit := int64(limit + 1)
opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}} opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}}
cur, err := store.connect.Database(store.database).Collection(store.collectionName).Find(ctx, where, opts) cur, err := store.connect.Database(store.database).Collection(store.collectionName).Find(ctx, where, opts)
for cur.Next(ctx) { for cur.Next(ctx) {
@ -212,7 +212,7 @@ func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, dirPath uti
entries = append(entries, entry) entries = append(entries, entry)
} }
hasMore = int64(len(entries)) == limit + 1 hasMore = int64(len(entries)) == limit+1
if hasMore { if hasMore {
entries = entries[:limit] entries = entries[:limit]
} }

View file

@ -67,7 +67,7 @@ func (store *MysqlStore) initialize(user, password, hostname string, port int, d
store.DB.SetMaxIdleConns(maxIdle) store.DB.SetMaxIdleConns(maxIdle)
store.DB.SetMaxOpenConns(maxOpen) store.DB.SetMaxOpenConns(maxOpen)
store.DB.SetConnMaxLifetime(time.Duration(maxLifetimeSeconds)*time.Second) store.DB.SetConnMaxLifetime(time.Duration(maxLifetimeSeconds) * time.Second)
if err = store.DB.Ping(); err != nil { if err = store.DB.Ping(); err != nil {
return fmt.Errorf("connect to %s error:%v", sqlUrl, err) return fmt.Errorf("connect to %s error:%v", sqlUrl, err)