5

I'd like to make a system that pulls github repositories automaticly using

System.cmd("git",["pull", link])

Is this command blocking? If I start it concurrently in many actors will I be always able to get as many pulls as actors (or at least socket limit for the system)?

If not is there anyway to acheive it?

Krzysztof Wende
  • 3,208
  • 25
  • 38

1 Answers1

3

Erlang and thus Elixir IO is non-blocking, so the IO of one process does not generally affect other processes in any way. Joe Armstrong describes this in a blog post:

So our code “looks like” we’re doing a synchronous blocking read. Looks like was in quotes, because it’s not actually a blocking read, it’s really an asynchronous read which does not block any other Erlang processes.

Patrick Oscity
  • 53,604
  • 17
  • 144
  • 168
  • Yes. But some functions use communication with singleton actors. Like make_ref/0 function. And they block entire system for a tiny while. – Krzysztof Wende Jun 17 '15 at 12:26
  • Interesting. Is this a problem in practice? Have you come across issues with this? I'm curious ;-) – Patrick Oscity Jun 17 '15 at 12:31
  • Not really. But I've heard many people having to track down these issues and optimize them. I mean it sounds reasonable. The system is not blocking but the actors are. So if many actors depends on response from single actor they all have to wait for him to finish his current job. And that's what was origin of my question, because I feel that this might ask one process holding some TTY instances. – Krzysztof Wende Jun 17 '15 at 12:43
  • Yeah having a TTY pool to have a defined number of instances running at a time seems like a good idea. – Patrick Oscity Jun 17 '15 at 13:00