return;
}
- if (!printer_list_need_refresh()) {
- /* has been just refeshed, skip */
- DEBUG(5, ("Refresh just happend, skipping.\n"));
- return;
- }
-
status = printer_list_mark_reload();
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to mark printer list for reload!\n"));
return status;
}
-bool printer_list_need_refresh(void)
-{
- NTSTATUS status;
- time_t last_refresh;
- int timediff;
-
- status = printer_list_get_last_refresh(&last_refresh);
- if (!NT_STATUS_IS_OK(status)) {
- return true;
- }
- timediff = time_mono(NULL) - last_refresh;
-
- if (timediff > 1 ) {
- /* if refresh occurred more than 1s (TODO:use lp_printcap_cache_time) ago,
- * then we need to refresh */
- return true;
- } else if (timediff < 0) {
- /* last_refresh newer than now. Seems we have no monotonic
- * clock and the clock was adjusted backwards.
- * we need to refresh which also resets last_refresh */
- return true;
- }
-
- return false;
-}
-
NTSTATUS printer_list_mark_reload(void)
{
struct db_context *db;
NTSTATUS printer_list_run_fn(void (*fn)(const char *, const char *, void *),
void *private_data);
-
-/**
- * @brief Check if the printer list needs to be refreshed.
- *
- * @return True if the database needs to be refreshed, false if
- * not.
- */
-bool printer_list_need_refresh(void);
-
#endif /* _PRINTER_LIST_H_ */