Guest User

Untitled

a guest
Jun 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import mercadoenvios.*
  2. import groovyx.gpars.GParsPool
  3.  
  4. def path = "/tmp/buyEqualShip/update_oblig/"
  5. def users = new File(path + 'users-mandatory-mlm.log').readLines()
  6.  
  7. resultFile = new File(path + 'dsa_log_result.log'); resultFile.write('')
  8. resultLog = { text -> resultFile << text + "\n" }
  9.  
  10. errorFile = new File(path + 'dsa_log_error.log'); errorFile.write('')
  11. errorLog = { text -> errorFile << text + "\n" }
  12.  
  13. GParsPool.withPool(10) {
  14. users.eachParallel { userId ->
  15. try {
  16. def tags = ctx.replicatedRedisService.get("tags-preferences-${userId}").tags
  17. tags.removeAll { it == "dsa_confirmed" }
  18. tags.removeAll { it == "mandatory_rollout" }
  19. tags << "dsa_confirmed"
  20. tags << "mandatory_rollout"
  21. ctx.replicatedRedisService.set("tags-preferences-${userId}", [tags: tags])
  22. ctx.memcachedShippingPreferencesService.delete(userId.toString())
  23. resultLog "${userId}"
  24. } catch (Exception e) {
  25. errorLog "${userId}"
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment