pmembrey/cakedb — pull request #15 by AlexandreBeaulne (2013-01-03 04:09:04+00:00)
Title: File write delay

The purpose of this pull request is solely to start a discussion on what I believe would be a useful feature for testing CakeDB.

The current 10 seconds delayed write ("flush") to binary files makes a lot of sense in a production environment in order to minimize the number of potentially costly file io operations. However, it makes testing harder: sleep instructions needs to be put here and there into unit tests as seen in the current drivers, and systematic testing (e.g. using PropEr) is made almost impossible.

I suggest we leave the 10 seconds as the default, but offer the user the possibility to overwrite the write delay as an environment parameter in the .app file to a value of his choice (by launching Erlang with CLI arguments, e.g. erl -cake write_delay 0).

This way it is easier for developers to write and run tests while the production version is left untouched.