--[[
	Used to decrease the number of consumers by 1, and if there are no more,
	cancel this promise.
]]

function Promise.prototype:_consumerCancelled(consumer)
	if self._status ~= Promise.Status.Started then
		return
	end

	self._consumers[consumer] = nil

	if next(self._consumers) == nil then
		self:cancel()
	end
end
