narqo / bem-pr

A set of bem-make extenstions to wrap common infrastructure's tasks
12 stars 22 forks source link

Fix race when running tests from bem-server #57

Closed SevInf closed 10 years ago

SevInf commented 10 years ago

Suppose that tests are running from bem server and user requests desktop.sets/some.tests/default/default.html. What happens:

  1. Browser requests desktop.sets/some.tests/default/default.html;
  2. Build is performed for this file and results are sent back to browser;
  3. After loading html page, browser requests both js and css simultaneously;
  4. Execution of build plan for js starts. As a part of a process, bemjson.js is created with test-tmpl tech;
  5. Execution of build plan for css starts on different worker. bemjson.js is generated too for this step. In order to write it, bem-tools opens file with w flag, write content of the file and closes it.
  6. Occasionally, building of bemdecl.js for js starts after bemjson file is opened in write mode by css plan (overriding its content), but before new content is written. Thus, no blocks from bemjson appear in bemdecl.

More general solution for i/o sync will be implemented in future versions of bem-tools, for now its just fix for bem-pr.

arikon commented 10 years ago

LGTM.

@narqo Вова, посмотри, и если ок, выпусти версию, пожалуйста

narqo commented 10 years ago

:+1:

0.3.6

dfilatov commented 10 years ago

:-1: Something is going wrong