anchor.diff:      erlang:send_after(Cycle, self(), 'crawl_accounts'),
       {'noreply', [], 'hibernate'};
   handle_info('next_account', [Account|Accounts]) ->
  -    _ = case kz_doc:id(Account) of
  -            <<"_design", _/binary>> -> 'ok';
  -            AccountId ->
  -                OpenResult = kz_datamgr:open_doc(?KZ_ACCOUNTS_DB, AccountId),
  -                check_then_process_account(AccountId, OpenResult)
  +    Cycle =
  +        case maybe_mark_account_dirty(kz_doc:id(Account)) of
  +            {'ok', 'marked_dirty'} ->
  +                kapps_config:get_integer(?MOD_CONFIG_CRAWLER, <<"interaccount_delay">>, 10 * ?MILLISECONDS_IN_SECOND);
  +            {'ok', 'no_need_to_mark'} ->
  +                2 * ?MILLISECONDS_IN_SECOND;
  +            {'error', _} ->
  +                2 * ?MILLISECONDS_IN_SECOND
           end,
  -    Cycle = kapps_config:get_integer(?MOD_CONFIG_CRAWLER, <<"interaccount_delay">>, 10 * ?MILLISECONDS_IN_SECOND),
       erlang:send_after(Cycle, self(), 'next_account'),
       {'noreply', Accounts, 'hibernate'};
   handle_info(_Info, State) ->
  
positive.code: 
  -spec handle_info(any(), state()) -> handle_info_ret_state(state()).
  handle_info('crawl_accounts', _) ->
      _ = case kz_datamgr:get_results(?KZ_ACCOUNTS_DB, ?CB_LISTING_BY_ID) of
              {'ok', JObjs} ->
                  self() ! 'next_account',
                  {'noreply', kz_util:shuffle_list(JObjs)};
              {'error', _R} ->
                  lager:warning("unable to list all docs in ~s: ~p", [?KZ_ACCOUNTS_DB, _R]),
                  self() ! 'next_account',
                  {'noreply', []}
          end;
  handle_info('next_account', []) ->
      kz_couch_compactor:compact_db(<<"services">>),
      NextDay = calendar:datetime_to_gregorian_seconds({erlang:date(),{0,45,0}}) + ?SECONDS_IN_DAY,
  
negative.code:         'true' ->
              lager:debug("IAM onbill crawler saving account ~s as dirty", [AccountId]),
              kz_services:save_as_dirty(AccountId),
              {'ok', 'marked_dirty'};
          'false' ->
              {'ok', 'no_need_to_mark'}
      end.
  