flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 08060d4cf56be09b945bce5847b41db3d668b683
parent f7ebb23b8dd297cf5281db3158b3bac2179ac011
Author: alex wennerberg <awennerb@twitch.tv>
Date:   Mon,  8 Nov 2021 00:20:37 -0500

Don't do istext (an inefficient function) for _every_ file on home load

this is a braindead optimization. there are a few others that are also
obvious.

Diffstat:
Mdb.go | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/db.go b/db.go @@ -84,13 +84,11 @@ type File struct { // also folders func fileFromPath(fullPath string) File { info, _ := os.Stat(fullPath) creatorFolder := getCreator(fullPath) - isText := isTextFile(fullPath) updatedTime := info.ModTime() return File{ Name: getLocalPath(fullPath), Creator: path.Base(creatorFolder), UpdatedTime: updatedTime, - IsText: isText, TimeAgo: timeago(&updatedTime), Host: c.Host, } @@ -222,6 +220,7 @@ func getMyFilesRecursive(p string, creator string) ([]File, error) { for _, file := range files { fullPath := path.Join(p, file.Name()) f := fileFromPath(fullPath) + f.IsText = isTextFile(fullPath) if file.IsDir() { f.Children, err = getMyFilesRecursive(path.Join(p, file.Name()), creator) }