How to use the internal.wait function in internal

To help you get started, we’ve selected a few internal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arangodb / arangodb / tests / js / server / resilience / transactions / resilience-transactions.js View on Github external
const waitForTasks = () => {
  const time = require("internal").time;
  const start = time();
  while (!tasksCompleted()) {
    if (time() - start > 300) { // wait for 5 minutes maximum
      fail("Timeout after 5 minutes");
    }
    require("internal").wait(0.5, false);
  }
  require('internal').wal.flush(true, true);
  // wait an extra second for good measure
  require("internal").wait(1.0, false);
};
github arangodb / arangodb / tests / js / server / resilience / transactions / resilience-transactions.js View on Github external
const waitForTasks = () => {
  const time = require("internal").time;
  const start = time();
  while (!tasksCompleted()) {
    if (time() - start > 300) { // wait for 5 minutes maximum
      fail("Timeout after 5 minutes");
    }
    require("internal").wait(0.5, false);
  }
  require('internal').wal.flush(true, true);
  // wait an extra second for good measure
  require("internal").wait(1.0, false);
};
github arangodb / arangodb / tests / js / server / recovery / multiple-journals-mmfiles.js View on Github external
db._drop('UnitTestsRecovery');
  var c = db._create('UnitTestsRecovery'), i, fig;

  for (i = 0; i < 1000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.wal.flush(true, true);
 
  // wait until journal appears 
  while (true) {
    fig = c.figures();
    if (fig.journals.count > 0) {
      break;
    }
    internal.wait(1, false);
  }
  c.rotate();

  for (i = 1000; i < 2000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.wal.flush(true, true);
 
  // wait until next journal appears 
  while (true) {
    fig = c.figures();
    if (fig.journals.count > 0) {
      break;
    }
    internal.wait(1, false);
github arangodb / arangodb / tests / js / server / recovery / multiple-journals-3-mmfiles.js View on Github external
db._drop('UnitTestsRecovery');
  var c = db._create('UnitTestsRecovery'), i, fig;

  for (i = 0; i < 1000; ++i) {
    c.save({ _key: 'test' + i, value1: 'test' + i, value2: i });
  }

  internal.wal.flush(true, true);
 
  // wait until journal appears 
  while (true) {
    fig = c.figures();
    if (fig.journals.count > 0) {
      break;
    }
    internal.wait(1, false);
  }

  internal.debugSetFailAt('CreateMultipleJournals');

  c.rotate();

  for (i = 200; i < 400; ++i) {
    c.remove('test' + i);
  }
  for (i = 500; i < 700; ++i) {
    c.update('test' + i, { value2: 'test' + i });
  }

  internal.wal.flush(true, true);
  
  // wait until next journal appears 
github arangodb / arangodb / tests / js / common / shell / shell-deadlocks-timecritical-noncluster-mmfiles-grey.js View on Github external
action: function () {
            require("internal").wait(7, false);
            var db = require("internal").db;
            db.UnitTestsDeadlock2.any();
            db.UnitTestsDeadlock1.insert({ done: true });
          }
        });

internal

MIT
Latest version published 5 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages