Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of Fibers in honour of EventMachine since it’s already reached version 1 milestone #1

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

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.

None yet

1 participant