cds-snc / cds-snc/platform-forms-client
ResponseDownloadLogger refactor
- Dominant language
- TypeScript
- Stars
- 46
- Forks
- 16
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 85
Description
Refactor the `ResponseDownloadLogger` for optimization and performance.
### Current behaviour:
For every line to be added to the logger file the system:
1. Opens the logger file
2. Reads the full content of the file to memory
3. Adds the line to the end of the content
4. Rewrites the whole file back to disk
5. Closes the file handle.
This can lead to a very heavy burden on the file system and memory for very verbose actions.
### Ideal behaviour:
The ResponseDownloadLogger batches messages to be logged or keeps a file handle open and appends data as needed.
Try to avoid reading the whole file into memory or multiple filehandle open/close for each response retrieval flow.
Contributor guide
Assessment
This issue has not been assessed yet.