Commit be7a3755 authored by Ramon Nou's avatar Ramon Nou
Browse files

Fix progress loop and add comments

parent ab00c592
Loading
Loading
Loading
Loading
Loading
+33 −34
Original line number Diff line number Diff line
@@ -107,13 +107,7 @@ worker::run() {

    bool done = false;
    while(!done) {

        auto msg = world.iprobe();

        if(!msg) {
            // FIXME: sleep time should be configurable

            // Progress through all transfers
        // Always loop pending operations

        auto I = m_ops.begin();
        auto IE = m_ops.end();
@@ -141,6 +135,11 @@ worker::run() {
            }
        }


        auto msg = world.iprobe();

        if(!msg) {
            // Only wait if there are no pending operations and no messages
            if(m_ops.size() == 0) {
                std::this_thread::sleep_for(150ms);
            }
@@ -158,8 +157,8 @@ worker::run() {
                LOGGER_INFO("msg => from: {} body: {}", msg->source(), m);
                m_ops.emplace(std::make_pair(
                        make_pair(m.input_path(), m.output_path()),
                        make_pair(operation::make_operation(t, workers,
                                                            m.input_path(),
                        make_pair(operation::make_operation(
                                          t, workers, m.input_path(),
                                          m.output_path(), m_block_size),
                                  0)));