Method: Spider::Model::Storage::BaseStorage#commit_or_continue

Defined in:
lib/spiderfw/model/storage/base_storage.rb

#commit_or_continuebool

Commits the current transaction, or decreases transaction nesting.

Returns:

  • (bool)

    True if the transaction was successfully committed, false if transactions are not enabled (Raises a StorageException if transactions are supported but were not started)

Raises:



322
323
324
325
326
327
328
329
330
331
332
# File 'lib/spiderfw/model/storage/base_storage.rb', line 322

def commit_or_continue
    return false unless transactions_enabled?
    raise StorageException, "Commit without a transaction" unless in_transaction?
    if curr[:transaction_nesting] == 1
        commit
        curr[:transaction_nesting] = 0
        return true
    else
        curr[:transaction_nesting] -= 1
    end
end