mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
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:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user