MCPcopy
hub / github.com/strongloop/loopback / setupRaceConditionInReplication

Function setupRaceConditionInReplication

test/replication.test.js:1856–1871  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

1854 }
1855
1856 function setupRaceConditionInReplication(fn) {
1857 const bulkUpdate = TargetModel.bulkUpdate;
1858 TargetModel.bulkUpdate = function(data, options, cb) {
1859 // simulate the situation when a 3rd party modifies the database
1860 // while a replication run is in progress
1861 const self = this;
1862 fn(function(err) {
1863 if (err) return cb(err);
1864
1865 bulkUpdate.call(self, data, options, cb);
1866 });
1867
1868 // apply the 3rd party modification only once
1869 TargetModel.bulkUpdate = bulkUpdate;
1870 };
1871 }
1872
1873 function verifyInstanceWasReplicated(source, target, id) {
1874 return function verify(next) {

Callers 1

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…