Queuing mechanism on create?
Queuing mechanism on create?
Hi!
I was wondering if there's any queuing mechanism added to the Editor? I've read several post back from 2015/2016 that it would be added to the future and I'll be needing it for editor.create().
I'm reading text files into an array which have 1000+ rows and columns. I've experienced that it's not possible to loop through it like so:
function importFile (ged) {
for (let j= 0; j< ged.length; j++) {
editorVulnerability.create(false)
.set('testtypeid', ged[j][0])
.set('toolid', ged[j][1])
.set('outputtool', ged[j][2])
.set('scanid', ged[j][3])
.set('fp', ged[j][4])
.set('cvss_temp', ged[j][5])
.set('cvss_env', ged[j][6])
.set('cvss_base_new', ged[j][7])
.set('vuln_not_in_report', ged[j][8])
.set('ip', ged[j][9])
.set('mac', ged[j][10])
.set('netbiosname', ged[j][11])
.set('os', ged[j][12])
.set('start', ged[j][13])
.set('stop', ged[j][14])
.set('plugin_id', ged[j][15])
.set('plugin_name', ged[j][16])
.set('port', ged[j][17])
.set('protocol', ged[j][18])
.set('cve', ged[j][19])
.set('cvss_base_score', ged[j][20])
.set('service_name', ged[j][21])
.set('description', ged[j][22])
.set('solution', ged[j][23])
.submit();
}
If there's any solution to wait for the data to be submitted and then continue with the loop I would love to hear it! Or any other suggestions.
Have a great day!
This question has an accepted answers - jump to answer
Answers
I found a solution, but I'm not too happy about it..
Still if there's any form of queuing mechanism for the editor, I'll be glad to hear about it!
Yup - there is a better way . The
create()
method has an optional parameter that can be set to tell it how many rows to create. Then use the multi-row editing api (specificallyfield().multiSet()
in this case) to set the values you need. Then a singlesubmit()
call is all that is needed.This assumes that whatever you are using on the server-side works for multi-row editing of course.
Allan