fix: storage setting changed don't take effect (#2385)

* fix: Storage setting changed don't take effect

* fix: Storage setting changed don't take effect

* fix: Storage setting changed don't take effect
This commit is contained in:
guopeng
2023-10-16 21:07:21 +08:00
committed by GitHub
parent c999d71455
commit 73f59eaf09
6 changed files with 67 additions and 7 deletions

View File

@ -3,8 +3,11 @@ package sqlite
import (
"context"
"database/sql"
"os"
"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"modernc.org/sqlite"
"github.com/usememos/memos/server/profile"
@ -137,6 +140,15 @@ func (d *DB) BackupTo(ctx context.Context, filename string) error {
return nil
}
func (d *DB) GetCurrentDBSize(context.Context) (int64, error) {
fi, err := os.Stat(d.profile.DSN)
if err != nil {
return 0, status.Errorf(codes.Internal, "failed to get file info: %v", err)
}
return fi.Size(), nil
}
func (d *DB) Close() error {
return d.db.Close()
}