Groovy web console

subscribe to the feed Subscribe
to this
site
Batch Request (via #groovywebconsole)
tweet this snippet Tweet
this
script

Batch Request

Published 3 months ago by Ibrahim
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
int total = 937
int batchSize = 100
int startIndex = 0
int maxIndex = Math.min(batchSize, total)

int iterationCount = 1
while(startIndex < total) {
   maxIndex = Math.min((startIndex + batchSize)-1, total-1)
   println "iterationCount: ${iterationCount}"
   println "startIndex: ${startIndex}"
   println "maxIndex: ${maxIndex}"
   iterationCount++
   startIndex += batchSize
   println "+"*50
}