]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix estimate code with limit
authorEric Bollengier <eric@baculasystems.com>
Thu, 9 Mar 2023 15:49:46 +0000 (16:49 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/findlib/find_one.c
bacula/src/jcr.h

index 7e58b507342c608b5cf45793aa2152e75c157931..7c5089b1fec67cf44a2de478fdf525008c7f2a0c 100644 (file)
@@ -823,11 +823,15 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt,
        *    before traversing it.
        */
       rtn_stat = 1;
-      while (!job_canceled(jcr) && rtn_stat == 1) {
+      while (!job_canceled(jcr)) {
          char *p, *q, *s;
          int l;
          int i;
 
+         if (jcr->estimate_limit > 0 && jcr->JobFiles >= jcr->estimate_limit) {
+            Dmsg0(10, "We have reached the number of items to display in estimate\n");
+            break;
+         }
          status = breaddir(directory, dname.addr());
          if (status != 0) {
             /* error or end of directory */
index 7dbf1cbdf6a4a161ec3a2be8cf5645672cc96881..b40ad7be8a0b4b70456936532b659a99b53e5f81 100644 (file)
@@ -362,6 +362,7 @@ public:
    char StatusInfo[MAX_NAME_LENGTH];  /* Additionnal information about the error status */
    time_t last_stat_time;             /* Last time stats sent to Dir */
    time_t stat_interval;              /* Stats send interval default 30s, set to -1 to disable */
+   uint32_t estimate_limit;                /* Number of files to display in estimate */
    uint32_t getErrors() { return JobErrors + SDErrors; }; /* Get error count */
    bool sendProgressStatus();         /* Send the progress status to the dir (SD/FD) */
 
@@ -475,7 +476,6 @@ public:
    int incremental;                   /* set if incremental for SINCE */
    utime_t mtime;                     /* begin time for SINCE */
    int listing;                       /* job listing in estimate */
-   int estimate_limit;                /* Number of files to display in estimate */
    long Ticket;                       /* Ticket */
    char *big_buf;                     /* I/O buffer */
    POOLMEM *compress_buf;             /* Compression buffer */