Skip to content

Instantly share code, notes, and snippets.

@kocolosk
Created April 23, 2010 01:18
Show Gist options
  • Save kocolosk/376049 to your computer and use it in GitHub Desktop.
Save kocolosk/376049 to your computer and use it in GitHub Desktop.
drop_cache(Db) ->
Cmd = couch_config:get("couchdb", "bin_dir") ++ "/drop_cache " ++
Db#db.filepath,
Port = erlang:open_port({spawn, Cmd}, [exit_status]),
?LOG_DEBUG("waiting for drop_cache exit while compacting ~p", [Db#db.name]),
receive
{Port, {exit_status, 0}} ->
ok;
{Port, {exit_status, Status}} ->
?LOG_ERROR("drop_cache on ~s exited with ~p", [Db#db.filepath, Status]),
ok
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment