isJobInList-1.js 568 B

1234567891011121314151617181920212223242526272829
  1. const content = `--[[
  2. Checks if job is in a given list.
  3. Input:
  4. KEYS[1]
  5. ARGV[1]
  6. Output:
  7. 1 if element found in the list.
  8. ]]
  9. -- Includes
  10. --[[
  11. Functions to check if a item belongs to a list.
  12. ]]
  13. local function checkItemInList(list, item)
  14. for _, v in pairs(list) do
  15. if v == item then
  16. return 1
  17. end
  18. end
  19. return nil
  20. end
  21. local items = redis.call("LRANGE", KEYS[1] , 0, -1)
  22. return checkItemInList(items, ARGV[1])
  23. `;
  24. export const isJobInList = {
  25. name: 'isJobInList',
  26. content,
  27. keys: 1,
  28. };
  29. //# sourceMappingURL=isJobInList-1.js.map