Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got REQUEST_TIMEOUT making many calls against a DB service with mongo, I have got some questions #874

Open
developez opened this issue Feb 20, 2021 · 0 comments

Comments

@developez
Copy link

developez commented Feb 20, 2021

I have got a DB Service that uses mongo, I am using the already existent method "insert". After many calls in a short time I got a REQUEST_TIMEOUT. The issue is, that, finally the insert action is done because I am controlling all the data sent with a simple id, and I can see the json sent saved in the mongo collection.

But, my question is, when the call fails and it is "retryable", which is the method to fire again the call, there is a stack in the memory of the microservice? Is it used the transport? Or is a simple "setTimeOut"? How many retries are done in a REQUEST_TIMEOUT? Why the request_timeout is appear up?

Thank you

RequestTimeoutError: Request is timed out when call 'logs.insert' action on 'e0018-33060' node.
    at C:\...\TestingMoleculer\monitor-log\node_modules\moleculer\src\middlewares\timeout.js:42:14
    at runMicrotasks (<anonymous>)
    at runNextTicks (internal/process/task_queues.js:58:5)
    at listOnTimeout (internal/timers.js:523:9)
    at processTimers (internal/timers.js:497:7) {
  code: 504,
  type: 'REQUEST_TIMEOUT',
  data: { action: 'logs.insert', nodeID: 'e0018-33060' },
  retryable: true
}

The DB Service.

"use strict";
import {Context, Service, ServiceBroker, ServiceSchema} from "moleculer";

import DbConnection from "../mixin/db.mixin";

import DbService from "moleculer-db";

const MongoAdapter = require("moleculer-db-adapter-mongo");

export default class LogDbService extends Service{

	// @ts-ignore
	public  constructor(public broker: ServiceBroker, schema: ServiceSchema<{}> = {}) {
		
		super(broker);
		this.parseServiceSchema(Service.mergeSchemas({
			name: "logs",
			mixins: [DbService],			
			adapter: new MongoAdapter(process.env.MONGO_URI),
			collection: "logs",
			settings: {

			},
			hooks: {

			},
			actions: {
				/**
				 * The "moleculer-db" mixin registers the following actions:
				 *  - list
				 *  - find
				 *  - count
				 *  - create
				 *  - insert
				 *  - update
				 *  - remove
				 */			
				
			},
			methods: {
				
			},
			
		}, schema));
	}
}
@developez developez changed the title I got REQUEST_TIMEOUT makeing many calls againts DB service with mongo. Questions. I got REQUEST_TIMEOUT making many calls against a DB service with mongo, I have got some questions Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant