MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ... to show where the warning was created)
Do you know how can I fix the situation?
Btw, a friend told me I should add a lot of commands in the same event... Do you think that would help? Thank you for your time :)
The error states that you have 11 message listeners open. You should only ever have 1 - since you can put all of your commands in the single message listener.
It would be helpful if you could post your main.js file content.
It should look like this:
client.on("message", (message) => {
if (message.content === "!examplecommand") {
//command code here
}
};
Please make sure you don't use 1 message event listener per command.
Related
getAllvehicleList : function(component, event, helper)
{
var action = component.get("c.retrieveVehicle");
action.setParams({'status':component.get("v.status")});
action.setCallback(this, fuction(data) {
enter code here
component.set('v.vehicleList',data.getRetrunValue())
});
$A.enqueueAction(action);
}
Line : 5
Error : Parsing error: Unexpected token {
Please explain the error which come at line number 4 in this code.
You have spelled the JavaScript keyword function incorrectly.
You have also misspelled the standard Aura method name getReturnValue().
Making errors like this will often cause the compiler to show you errors that do not obviously make sense because they do not reflect your intent, but rather what you actually wrote. You'll be able to make progress more quickly if you develop the skill of proofreading your own code. Syntax highlighting in your editor and tools like ESLint can also help spot this type of mistake.
I'm working on a discord bot for a D&D game. I want the bot to be able to recognize when someone has recently used a command. This is what I have so far;
const barid = require("./tavernarray.json")
var tavernarray = barid.guests;
message.channel.send('Tavern Keeper Emotes and replies;')
if (message.member.roles.cache.has('770678762944725003')){
if (tavernarray.includes(message.author.id)){
message.channel.send("Weren't you just here?");
} else;
tavernarray.push(message.author.id);
message.channel.send(` Welcome to the Tavern Guild Master ${message.author}`);
setInterval (() => {
tavernarray.pop(message.author.id)
}, 30000)
} else {
message.channel.send("Error no role");
}
From what I can tell the code works in that on the first command, we get the welcome message expected and the user ID is added to the array. On the second command though, there's a short delay and then we get both messages. Should I be using setTimeout instead of setInterval? Or is it an issue with using a .json array? I tried keeping the array in the program, but it just kept resetting every time I ran it.
Yes, you should be using setTimeout(). The reason you might have an issue is because the code is trying to remove the variable from the JSON array every 30 seconds which will cause two issues: higher memory usage and potential errors. The difference between setInterval() and setTimeout() is timeout executes the function once, whilst the other loops continuously until it is told to break. Along with this, the way you're using else is the issue. When you use else; (Take into note the semi colon), you're telling the code that if the ID isn't there, it shouldn't execute any code, as a semi colon indicates the end of a line of code. A snippet is shown below
if (tavernarray.includes(message.author.id)){
message.channel.send("Weren't you just here?");
} else { // Instead of ; we'll use {}
tavernarray.push(message.author.id);
message.channel.send(` Welcome to the Tavern Guild Master ${message.author}`);
setInterval (() => {
tavernarray.pop(message.author.id)
}, 30000)
}
I'm trying to create my own Windows service in C according to this tutorial. My event message definition file looks like this
EventLogMessages.mc:
MessageIdTypedef=DWORD
SeverityNames=(
Success=0x0:STATUS_SEVERITY_SUCCESS
Info=0x1:STATUS_SEVERITY_INFO
Warning=0x2:STATUS_SEVERITY_WARNING
Error=0x3:STATUS_SEVERITY_ERROR
)
FacilityNames=(
System=0x0:FACILITY_SYSTEM
Runtime=0x2:FACILITY_RUNTIME
Stubs=0x3:FACILITY_STUBS
Io=0x4:FACILITY_IO_ERROR_CODE
)
LanguageNames=(English=0x409:MSG00409)
; // The following are message definitions.
MessageId=0x1
Severity=Success
Facility=Runtime
SymbolicName=SVCEVENT_STATUS_REPORT
Language=English
Status report: %2.
.
MessageId=0x2
Severity=Error
Facility=System
SymbolicName=SVCEVENT_INIT_SYSCALL_ERROR
Language=English
Essential syscall failed when starting the service: %2.
.
MessageId=0x3
Severity=Error
Facility=Runtime
SymbolicName=SVCEVENT_CUSTOM_ERROR
Language=English
Service-specific error: %2.
.
; // A message file must end with a period on its own line
; // followed by a blank line.
It's almost a copy of the sample file from docs.
However whenever i compile this file, start the service and open the Event Viewer, i see all messages from my service as "Level: Error", even those that should have lower severity.
The event IDs and the messages are correct, but the severity is always wrong.
I opened the the generated header file EventLogMessages.h and here it seems alright as well.
#define SVCEVENT_STATUS_REPORT ((DWORD)0x00020001L)
The upper 2 bits (that indicate severity) are correctly set to 0 - STATUS_SEVERITY_SUCCESS.
But regardless, the event is always displayed wrong.
Anyone has a clue why it's wrong and how to fix it?
So i figured it out by trial and error.
The severity is in fact only controlled by the 2nd parameter of ReportEvent and the upper bits of the messageID (that comes from the .mc file and goes to the 4th parameter) are totally ignored.
So to send a "warning" event, instead of defining the message properties like
MessageId=0x2
Severity=Warning
Facility=Runtime
SymbolicName=SVCEVENT_WARNING
...
you need to call the function this way
ReportEvent( hEventSource, EVENTLOG_WARNING_TYPE, 0, SVCEVENT_WARNING, ... );
Not sure what message severity is good for then, but it works.
I am pretty new to angularjs. Love it but sometimes get surprises that I just can't find an answer.
I have a function that lets the user build a list to a file by clicking a link. This can take up to a minute so the user can build different lists at the same time. The meaning is that once the file is build a popup appears to download it.
All of this works when only 1 file is build. After a half a minute the download popup shows up. But when 2 are build at the same time the second POST is cancelled (it arrives in the error callback) once the pop-up of the first appears.
If I remove $window.open both POST are finished succesfully and I get both fileId's in the console log.
Clearly the problem lies with $window.open. But why? What am I doing wrong or how can I solve this? Anyone an idea? I have been searching for hours already but can't seem to find anything on this case.
$scope.idPromise = $http.post(restPath, $scope.data)
.then(function(data){
console.log(data.data);
console.log(data.data.fileId);
$window.open(restPath + 'files/' + data.data.fileId, '_self');
},function(error){
console.log('promise error')
});
So when two lists are build without window.open in the code I get something like this in my console:
POST http://localhost:8080/xxx-rest/rest/lijsten/vastelijsten/gezinshoofdenMetLeden 200 OK 1m
POST http://localhost:8080/xxx-rest/rest/lijsten/vastelijsten/gezinshoofdenMetLeden 200 OK 1m 40s
report3545743463669473959.xlsx
report4733168386603499105.xlsx
when window.open is placed in the code:
POST
http://localhost:8080/xxx-rest/rest/lijsten/vastelijsten/gezinshoofdenMetLeden
200 OK 1m
POST
http://localhost:8080/xxx-rest/rest/lijsten/vastelijsten/gezinshoofdenMetLeden
x 56,39s
report1588183186872251177.xlsx
promise error
As you can see the last POST is stopped as soon as the first POST gets a response, so for the second POST no response is gotten.
Update
It seems the problem lies with the grunt server and the liveReload Protocol. My college had always told me to ignore this error but it is now clear that because the page loses connection that the promise fails.
Does anyone have experience with grunt and liveReload? Can I fix this? Will it work on a production server?
The console error I get:
De verbinding met ws://localhost:35729/livereload werd onderbroken
tijdens het laden van de pagina. this.socket = new
this.WebSocket(this._uri);
(translated: the connection with... was interrupted)
Good day guys can anyone give an example how to use this snippet https://github.com/arthurakay/ExtJS-Activity-Monitor.
I searched this snippet because i want to catch how long the user has been idle then i saw this snippet i think it can help me what i want to achieve but i dont know how to use it i just try to insert this Ext.Loader.setPath('Ext.ux', 'extjs/examples/ux') to my app.js then i dont know where and how to insert this code :Ext.ux.ActivityMonitor.init({ verbose : true }); Ext.ux.ActivityMonitor.start();.
now can anyone help or give me an example like alert message when idle of 1 min so that i can include this to my work Thanks in advance
Ext.ux.ActivityMonitor.init({
verbose: true
});
Ext.ux.ActivityMonitor.start();
Ext.ux.ActivityMonitor.isActive = function() {
Ext.Msg.alert('Monitor', 'User is active!');
}
Ext.ux.ActivityMonitor.isInactive = function() {
Ext.Msg.alert('Monitor', 'User is inactive!');
}
Something like this. I add more messages for console log, just move mouse in ACTIVITY AREA window, or change chrome tabs for reset invactive counter