Don’t try to load .mbtiles files during write (#73)

This commit is contained in:
Nik Molnar 2019-07-03 17:25:22 -07:00 committed by GitHub
parent c873e74160
commit 55f887a895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -174,6 +174,10 @@ func NewFromBaseDir(baseDir string, secretKey string) (*ServiceSet, error) {
if err != nil {
return err
}
if _, err := os.Stat(p + "-journal"); err == nil {
// Don't try to load .mbtiles files that are being written
return nil
}
if ext := filepath.Ext(p); ext == ".mbtiles" {
filenames = append(filenames, p)
}

View File

@ -196,6 +196,10 @@ func serve() {
if err != nil {
return err
}
if _, err := os.Stat(path + "-journal"); err == nil {
// Don't try to load .mbtiles files that are being written
return nil
}
if strings.HasSuffix(strings.ToLower(path), ".mbtiles") {
filenames = append(filenames, path)
}