Git Product home page Git Product logo

Comments (7)

tokahuke avatar tokahuke commented on June 6, 2024

Sorry for the late response. Working on other problems atm.

So... the current implementation is unbounded. You sugges being possible to limit the size of the queue? Similar to what happens to the channels in std.

We would need two methods:

  1. A fn try_send which fails on queue lmit and
  2. An async fn send to wait for the queue to clear.

Well... that is perfectly reasonable! Could you share details on your use case for context? I developed yaque to unload insane amounts of incoming data from memory and avoid OOM. So, a bounded channel didn't make much sense.

from yaque.

tokahuke avatar tokahuke commented on June 6, 2024

So.... @hh9527 I have been thinking about this on the back burner... something like this is indeed needed. However, I will not be able to give fine grained control on the number of elements, since that would require lots of sync with the Receiver, which looked suuuuper tricky.

On the other side, something like limiting the space used by controlling the creation of new segments is "easy" to do. In fact, that is the strategy used in queues such as Postgres' WAL log. I will start working on that today already. Got some time to spare!

from yaque.

tokahuke avatar tokahuke commented on June 6, 2024

Man, what reaaaly made my mind in this feature was spending up to 2am fixing pglogical issues exaclty because it didn't implement something like this. Thank God is looks like they solved it in Postgresql 13!

from yaque.

tokahuke avatar tokahuke commented on June 6, 2024

Merged pull request. I'll leave it there soaking before publishing....

from yaque.

tokahuke avatar tokahuke commented on June 6, 2024

@hh9527 are the mechanisms implemented in v0.6.0 what you were looking for? They are a bit coarse, but do help to stop the queue from growing uncontrollably.

from yaque.

hh9527 avatar hh9527 commented on June 6, 2024

@tokahuke thanks very very much to provide the mechanism.

in my use case: an agent is deployed beside a event source. event source emit events in push mode to agent. And agent is polled by a centric service. Agent may do some pre-processing. To avoid events make persistent storage too large, it will be necessary to limit the bound of event queue.

I've read the API docs, it was nice.

from yaque.

tokahuke avatar tokahuke commented on June 6, 2024

You are welcome! Nice that the docs were useful for something... about your use... looks a lot like the problem of database replication. However, there the event source will not wait for space to clear; therefore you are forced to abort the replication and start all over again.

... that is better than doing it manually, as I was forced to do in my job with postgresql logical replication. Thankfully, I was informed they corrected it in the most recent version..

from yaque.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.