cron_advertise.pl is strongly biased when choosing ads

Issue #10 resolved
Stefan Steinheimer created an issue

e.g. if only the first and last file in @adcreditfiles have credit, and there are n files, it will choose $adcreditfiles[0] only when $r == 0, and $adcreditfiles[n-1] in all other cases. Proposed solution: delete credit files when credit runs out.

Comments (2)

  1. 14mRh4X0r

    I replaced

    my @adcreditfiles = <${addir}/cred-*>;
    

    with

    my @adcreditfiles = `grep -lv '^0\$' ${addir}/cred-*`;
    chomp @adcreditfiles;
    

    so cred-[timestamp] files with a value of 0 get filtered out.

    I did it this way instead of removing them, since exec_advertise.pl expects that file to exist if the timestamp exists in account-[someuser]. Removing the timestamp from that file would mean removing the whole ad when all credits are spent, which is not what we want.

  2. Log in to comment