Fix unmarshalling issues and adjust logging for debugging
Modify `FunctionCall` struct to handle arguments as strings. Add debugging logs to facilitate error tracing and improve JSON unmarshalling in various functions.
This commit is contained in:
16
pkg/cache/directory.go
vendored
16
pkg/cache/directory.go
vendored
@@ -72,6 +72,18 @@ func (d *Directory) AutoCleanupRoutine(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Directory) openFileForWriting(key string) (*os.File, error) {
|
||||
path := d.GetPath(key)
|
||||
|
||||
fp, err := os.Create(path)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return fp, nil
|
||||
}
|
||||
|
||||
func (d *Directory) openFile(key string) (*os.File, error) {
|
||||
path := d.GetPath(key)
|
||||
|
||||
@@ -91,7 +103,7 @@ func (d *Directory) Set(key string, value io.Reader) error {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
|
||||
fp, err := d.openFile(key)
|
||||
fp, err := d.openFileForWriting(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -109,7 +121,7 @@ func (d *Directory) SetJSON(key string, value any) error {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
|
||||
fp, err := d.openFile(key)
|
||||
fp, err := d.openFileForWriting(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user