You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! Im trying to wrap my head around how the promoting works so let me share my (simplified) workflow and what problem I am facing:
I'm attaching a file to a rails record using: record.update(file: file)
I'm notifying external service about it
External service sends a request back to my API
My API endpoint is trying to return the attached file using record.file.open { ... }
I am using two storages: FileSystem for cache storage and S3 for store storage. Everything is running in a docker container which restarts from time to time and has no persistent storage configured so the cache storage path is being cleared out on each restart.
The thing is, from time to time, point 4 of the list above throws a following error:
Shrine::FileNotFound
file "e0b59ead00b6766.jpg" not found on storage
Errno::ENOENT
No such file or directory @ rb_sysopen - /app/public/uploads/cache/e0b59ead00b6766.jpg
It seems like, for some reason, file.open {...} from point 4 is trying to operate on the cached storage instead of the s3 one, file is being removed on container restart and the error is thrown. On the other hand, after checking this exact record hour after the incident, i can see the file being present on S3 so maybe Shrine is incorrectly using cache storage instead of store storage? How do you think that could be handled in order to prevent that from happening?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello! Im trying to wrap my head around how the promoting works so let me share my (simplified) workflow and what problem I am facing:
record.update(file: file)
record.file.open { ... }
I am using two storages: FileSystem for cache storage and S3 for store storage. Everything is running in a docker container which restarts from time to time and has no persistent storage configured so the cache storage path is being cleared out on each restart.
The thing is, from time to time, point 4 of the list above throws a following error:
It seems like, for some reason,
file.open {...}
from point 4 is trying to operate on the cached storage instead of the s3 one, file is being removed on container restart and the error is thrown. On the other hand, after checking this exact record hour after the incident, i can see the file being present on S3 so maybe Shrine is incorrectly using cache storage instead of store storage? How do you think that could be handled in order to prevent that from happening?Thanks in advance for any clues!
Beta Was this translation helpful? Give feedback.
All reactions