Fixing a race condition between progress bars

[?]
Dec 6, 2020, 9:21 PM
5QTMRUXNE2XNJCMLN6MQN24UEZ55EFC3LIR4PO6OPNTT5KEL7WXQC

Dependencies

  • [2] HXEIH4UQ Pulling more than 100 changes at once
  • [3] KTTKF3RW Locking stderr and the progress bar in SSH
  • [4] K6GWUOD5 Styling progress bars
  • [5] 367UBQ6K Forwarding SSH stderr, and progress bar for push
  • [6] FBXYP7QM Forgot to add remote::http
  • [7] Q45QHPO4 Feedback on network stuff
  • [8] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [9] PCEJFKFX Progress bar for upload and apply
  • [10] UDHP4ZVB Fixing SSH asynchronicity issues
  • [*] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [*] I52XSRUH Massive cleanup, and simplification

Change contents

  • replacement in pijul/src/remote/ssh.rs at line 690
    [4.80][4.80:155]()
    .template(" Uploading changes {wide_bar} {pos}/{len}"),
    [4.80]
    [4.155]
    .template(" Uploading changes {wide_bar} {pos:>5}/{len}"),
  • edit in pijul/src/remote/ssh.rs at line 692
    [4.166]
    [3.333]
    let progress = super::PROGRESS.add(progress);
  • replacement in pijul/src/remote/ssh.rs at line 719
    [3.653][3.653:734]()
    .template("✓ Uploading changes {wide_bar} {pos}/{len}"),
    [3.653]
    [3.734]
    .template("✓ Uploading changes {pos:>5}/{len}"),
  • replacement in pijul/src/remote/ssh.rs at line 777
    [4.80][4.80:155]()
    .template(" Downloading changes {wide_bar} {pos}/{len}"),
    [4.80]
    [4.155]
    .template(" Downloading changes {wide_bar} {pos:>5}/{len}"),
  • replacement in pijul/src/remote/ssh.rs at line 798
    [3.1304][3.1304:1389]()
    .template("✓ Downloading changes {wide_bar} {pos}/{len}"),
    [3.1304]
    [3.1389]
    .template("✓ Downloading changes {pos:>5}/{len}"),
  • edit in pijul/src/remote/mod.rs at line 4
    [12.439]
    [13.516]
    use lazy_static::lazy_static;
  • edit in pijul/src/remote/mod.rs at line 28
    [4.52848]
    [4.52848]
    }
    lazy_static! {
    static ref PROGRESS: Arc<indicatif::MultiProgress> = Arc::new(indicatif::MultiProgress::new());
  • replacement in pijul/src/remote/mod.rs at line 468
    [4.986][4.986:1065]()
    .template(" Applying changes {wide_bar} {pos}/{len}"),
    [4.986]
    [4.1065]
    .template(" Applying changes {wide_bar} {pos:>5}/{len}"),
  • replacement in pijul/src/remote/mod.rs at line 470
    [4.1080][4.729:749](),[4.729][4.729:749]()
    Some(p)
    [4.1080]
    [4.749]
    Some(PROGRESS.add(p))
  • edit in pijul/src/remote/mod.rs at line 474
    [4.794]
    [4.69865]
    let t_progress = std::thread::spawn(|| {
    PROGRESS.join().unwrap_or(());
    });
  • replacement in pijul/src/remote/mod.rs at line 504
    [4.1177][4.1177:1262]()
    .template("✓ Applying changes {wide_bar} {pos}/{len}"),
    [4.1177]
    [4.1262]
    .template("✓ Applying changes {pos:>5}/{len}"),
  • edit in pijul/src/remote/mod.rs at line 511
    [2.321]
    [4.70716]
    t_progress.join().unwrap();
  • replacement in pijul/src/remote/http.rs at line 26
    [4.1362][4.1362:1437]()
    .template(" Downloading changes {wide_bar} {pos}/{len}"),
    [4.1362]
    [4.1437]
    .template(" Downloading changes {wide_bar} {pos:>5}/{len}"),
  • edit in pijul/src/remote/http.rs at line 28
    [4.1448]
    [4.432]
    let progress = super::PROGRESS.add(progress);
  • replacement in pijul/src/remote/http.rs at line 66
    [4.1537][4.1537:1618]()
    .template("✓ Downloading changes {wide_bar} {pos}/{len}"),
    [4.1537]
    [4.1618]
    .template("✓ Downloading changes {pos:>5}/{len}"),
  • replacement in pijul/src/remote/http.rs at line 82
    [4.1714][4.336:411]()
    .template(" Uploading changes {wide_bar} {pos}/{len}"),
    [4.1714]
    [4.1787]
    .template(" Uploading changes {wide_bar} {pos:>5}/{len}"),
  • replacement in pijul/src/remote/http.rs at line 106
    [4.1827][4.1827:1879](),[4.1879][4.412:489]()
    indicatif::ProgressStyle::default_bar()
    .template("✓ Uploading changes {wide_bar} {pos}/{len}"),
    [4.1827]
    [4.1954]
    indicatif::ProgressStyle::default_bar().template("✓ Uploading changes {pos:>5}/{len}"),