var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.dropPendingTasks = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _createDeleteQuery = require("../sqlite-utils/createDeleteQuery");
var _SqliteClient = require("../SqliteClient");
var dropPendingTasks = exports.dropPendingTasks = function () {
  var _ref2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(_ref) {
    var messageId, _ref$execute, execute, queries;
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          messageId = _ref.messageId, _ref$execute = _ref.execute, execute = _ref$execute === void 0 ? true : _ref$execute;
          queries = [(0, _createDeleteQuery.createDeleteQuery)('pendingTasks', {
            messageId: messageId
          })];
          _SqliteClient.SqliteClient.logger == null || _SqliteClient.SqliteClient.logger('info', 'dropPendingTasks', {
            messageId: messageId
          });
          if (!execute) {
            _context.next = 6;
            break;
          }
          _context.next = 6;
          return _SqliteClient.SqliteClient.executeSqlBatch(queries);
        case 6:
          return _context.abrupt("return", queries);
        case 7:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return function dropPendingTasks(_x) {
    return _ref2.apply(this, arguments);
  };
}();
//# sourceMappingURL=dropPendingTasks.js.map