-max_zoom = <%= node[:tile][:styles].collect { |n,d| d[:max_zoom] }.max %>
-
-ARGV.each do |f|
- Expire::expire(f, 13, max_zoom, tile_dirs)
+Dir.glob("/var/lib/replicate/expire-queue/changes-*.txt").sort.each do |f|
+ <% node[:tile][:styles].each do |name,details| -%>
+ system("/usr/bin/render_expired", "--map=<%= name %>", *args, "--max-zoom=<%= details[:max_zoom] %>", :in=> f) &&
+ <% end -%>
+ File::unlink(f)