5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 03:09:17 +08:00

[v2] AssetsHandler remove retry logic in dev mode (#1479)

This commit is contained in:
stffabi 2022-06-22 12:06:20 +02:00 committed by GitHub
parent f8eac34212
commit 4493a05fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,6 @@ import (
"os"
"path"
"strings"
"time"
"github.com/wailsapp/wails/v2/internal/fs"
"github.com/wailsapp/wails/v2/internal/logger"
@ -55,11 +54,6 @@ func NewAssetHandler(ctx context.Context, options *options.App) (http.Handler, e
result := &assetHandler{
fs: vfs,
handler: options.AssetsHandler,
// Retry the loading of missing files on the Assets if we are in dev mode (with an AssetDir) and
// if the user doesn't use the AssetsHandler. If AssetsHandler are in use we would defer
// every request to the handler for 5s which is not quite useful.
retryMissingFiles: ctx.Value("assetdir") != nil && (options.AssetsHandler == nil),
}
if _logger := ctx.Value("logger"); _logger != nil {
@ -112,15 +106,6 @@ func (d *assetHandler) serveFSFile(rw http.ResponseWriter, filename string) erro
}
file, err := d.fs.Open(filename)
if err != nil && d.retryMissingFiles {
for tries := 0; tries < 50; tries++ {
file, err = d.fs.Open(filename)
if err != nil {
time.Sleep(100 * time.Millisecond)
}
}
}
if err != nil {
return err
}