Per-Magnus Holtmo: Using gRPC to fight Mordor

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 4

  • @erkintek
    @erkintek 10 месяцев назад

    I cant understand why boost asio post is used!

    • @QuavePL
      @QuavePL 10 месяцев назад +2

      as async task executor

    • @Roibarkan
      @Roibarkan 10 месяцев назад +1

      To elaborate on @QuavePL’s answer - I believe the idea is that all the public functions in AsyncService should return as quickly as possible and have their work done asynchronously (for example in another thread, and in this case on the main thread) and call ‘Finish()’ when they are done (when they populated the response object, ideally). This quick return “ensures” that the gRPC thread isn’t blocked.

    • @pmholtmo6585
      @pmholtmo6585 10 месяцев назад +3

      Correct answers above. We need to handle the request in a separate thread for asynchronous handling and return the call from the gRPC thread directly. I just picked boost asio as an example since it is pretty easy to work with.