Source: /cirosantilli/_file/nodejs/sequelize/parallel_select_and_update.js

= nodejs/sequelize/parallel_select_and_update.js
{file}

This example is the same as <nodejs/sequelize/raw/parallel_select_and_update.js>{file}, but going through <Sequelize> rather than with <Sequelize raw queries>. `NONE` is not supported for now to not have a transaction at all because lazy.

The examples illustrates: https://stackoverflow.com/questions/55452441/for-share-and-for-update-statements-in-sequelize

Sample invocation:
``
node --unhandled-rejections=strict ./parallel_select_and_update.js p 10 100 READ_COMMITTED UPDATE
``
where:
* `READ_COMMITTED`: one of the keys documented at: https://sequelize.org/master/class/lib/transaction.js~Transaction.html which correspond to the standard <sQL isolation levels>. It not given, don't set one, defaulting to the database's/sequelize's default level.
* `UPDATE`: one of the keys documented at: https://sequelize.org/master/class/lib/transaction.js~Transaction.html\#static-get-LOCK[]. Update generates a `SELECT FOR UPDATE` in <PostgreSQL> for example. If not given, don't use any `FOR xxx` explicit locking.

Other examples:
* `node --unhandled-rejections=strict ./parallel_select_and_update.js p 10 100 READ_COMMITTED UPDATE`

Then, the outcome is exactly as described at: <nodejs/sequelize/raw/parallel_select_and_update.js>{file}:
* `READ_COMMITTED`: fails
* `READ_COMMITTED UPDATE`: works
* `REPEATABLE_READ`: works, but is a bit slower, as it does rollbacks

  This case also illustrates <Sequelize transaction retries>, since in this transaction isolation level transactions may fail:
  * https://stackoverflow.com/questions/68427796/sequelize-transaction-retry-doenst-work-as-expected
  * https://github.com/sequelize/sequelize/issues/1478
  * https://github.com/sequelize/sequelize/issues/8294