Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SmarterCSV thread-safe #277

Closed
wants to merge 2 commits into from
Closed

Commits on Apr 9, 2024

  1. Make SmarterCSV thread-safe

    * SmarterCSV used instance variables on a module, so they were shared across all threads
    
    * When different threads ran SmarterCSV, they could overwrite the instance values that were set, and effectively corrupt eachothers day. The simplest way to show this was to run a full `process` call from multiple threads - each threads data gets aggregated together into one large result
    
    * By using an instance, and passing it around, we simulate a insance approach while maintaining the current API
    
    * We also expose a thread-local set of instance variables which should provide backwards compatibility if someone were to directly access the global instance variables on the SmarterCSV module (which a spec did, and that's how I noticed this behavior)
    jpcamara committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    90ec4c5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7f74f78 View commit details
    Browse the repository at this point in the history