Can you explain a little bit more why Rails is causing some generated files 
to be required twice?

Unless there is a really good reason for this, it seems better to debug why 
files are being loaded twice. Protobuf generated files aren't designed to 
be required multiple times. If we add some hacks to allow this, it seems 
like it would just hide the problem and make things more complicated.

On Wednesday, December 27, 2017 at 4:20:24 AM UTC-8, Marko Bogdanović wrote:
>
> When the Google::Protobuf::DescriptorPool.generated_pool.build is called 
> twice with the same message types, the error is being thrown saying that 
> DescriptorPool has already registered message with the same name. I see 
> that as expected behavior.
>
>
> Though, I need to include GRPC generated files within Rails codebase which 
> some parts are eagerly loaded.
>
>
> Is there any possible way to tell protobuf to generate Ruby classes and 
> modules instead of generating 
> Google::Protobuf::DescriptorPool.generated_pool.build block? In case it 
> has generated classes, the require on that file more than once wouldn't 
> throw an error.
>
> I see the only way to fix this is to add some condition before 
> Google::Protobuf::DescriptorPool.generated_pool.build block, letting it 
> register messages unless these are already defined.
>
>
> BTW I wanted to run gprc server within a rake task when I stumbled upon 
> this issue.
>
>
> Please tell me if I am missing something, which is quite likely. 
>
> Thank you
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to