Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mercadoenvios.*
- import groovyx.gpars.GParsPool
- def path = "/tmp/buyEqualShip/update_oblig/"
- def users = new File(path + 'users-mandatory-mlm.log').readLines()
- resultFile = new File(path + 'dsa_log_result.log'); resultFile.write('')
- resultLog = { text -> resultFile << text + "\n" }
- errorFile = new File(path + 'dsa_log_error.log'); errorFile.write('')
- errorLog = { text -> errorFile << text + "\n" }
- GParsPool.withPool(10) {
- users.eachParallel { userId ->
- try {
- def tags = ctx.replicatedRedisService.get("tags-preferences-${userId}").tags
- tags.removeAll { it == "dsa_confirmed" }
- tags.removeAll { it == "mandatory_rollout" }
- tags << "dsa_confirmed"
- tags << "mandatory_rollout"
- ctx.replicatedRedisService.set("tags-preferences-${userId}", [tags: tags])
- ctx.memcachedShippingPreferencesService.delete(userId.toString())
- resultLog "${userId}"
- } catch (Exception e) {
- errorLog "${userId}"
- }
- }
- }
Add Comment
Please, Sign In to add comment