Skip to content

Conversation

@mudasobwa
Copy link

— Introduced mutex on “register_handle” to prevent double-registering; the former solution with a variable “@ready” was not sufficient due to possible context switch inside “unless ready” block;
— Got rid of Fibers in honour of EventMachine, using mapped nested Iterators in the following manner:

@stream.write_with_handler(disco) do |result|

  # iterate thru disco results and wait until all collected
  EM::Iterator.new(result.items).map proc{ |c, it_disco|

    @stream.write_with_handler(info) do |reply|

      # iterate thru discoinfo results and wait until all collected,
      # then switch the parent’s iterator
      EM::Iterator.new(reply.features).map proc{ |f, it_info|
        it_info.return 
      }, proc{ |comps|
        # one more disco item was utilized
        it_disco.return 
      }
             
    end

  }, proc{ |compss|
    # yielding

  }
end

— Introduced “@components” variable to collect components, if there are many returned by discovery. This is done ‘de bene esse’ and used currently to log warning of a kind “Hey, we use the first instance of components out of N available”

@mudasobwa
Copy link
Author

Plus added asyncronous output from shell (for infinite looped commands like “ping google.com” or “tail -f …”).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant