Trevinho disagrees with me, but I want to put on the record that I think comment #6's patch is wrong and that instead the VACUUM mode should explicitly check if the database exists and "return 0" in that case.
Rationale:
It's reasonable to say that it's okay to run without having run the main program first. The counter argument says that this is *not* reasonable and you would expect an error in this case. I think that there is no one true way here, and you should write programs with their intended usage in mind. In this case I think the intented use is that you could imagine a user writing a shell script such as:
#!/bin/sh
set -e
zeitgeist-vacuum # or zeitgeist --vacuum
zeitgeist
(of course this is a simplified version of the existing user unit's control flow)
and it's just silly to have to detect the DB not existing explicitly there. It's also a bit shady to ignore VACUUM failures that could point to a more severe problem.
For the record, I think the code to implement my change would look like this (untested).
var file = File.new_for_path (db_path);
if (!file.query_exists ())
{
debug ("Database '%s' doesn't exist, but that's okay".printf (db_path));
return 0;
}
With this change the unit file can remain unmodified.
Since there's disagreement, I won't unilaterally upload my suggestion.
Trevinho disagrees with me, but I want to put on the record that I think comment #6's patch is wrong and that instead the VACUUM mode should explicitly check if the database exists and "return 0" in that case.
Rationale:
It's reasonable to say that it's okay to run without having run the main program first. The counter argument says that this is *not* reasonable and you would expect an error in this case. I think that there is no one true way here, and you should write programs with their intended usage in mind. In this case I think the intented use is that you could imagine a user writing a shell script such as:
#!/bin/sh
set -e
zeitgeist-vacuum # or zeitgeist --vacuum
zeitgeist
(of course this is a simplified version of the existing user unit's control flow)
and it's just silly to have to detect the DB not existing explicitly there. It's also a bit shady to ignore VACUUM failures that could point to a more severe problem.
For the record, I think the code to implement my change would look like this (untested).
var file = File.new_for_path (db_path);
if (!file.query_exists ())
{
debug ("Database '%s' doesn't exist, but that's okay".printf (db_path));
return 0;
}
With this change the unit file can remain unmodified.
Since there's disagreement, I won't unilaterally upload my suggestion.