Coder Social home page Coder Social logo

Comments (5)

aumetra avatar aumetra commented on September 28, 2024 1

To be fair, the whole ActivityPub fetching logic with the database mapping needs a major cleanup. It's in an abysmal state at the moment.

Maybe that cleanup can also add better testing to it finally.

from kitsune.

tesaguri avatar tesaguri commented on September 28, 2024

I think the ideal handling of threads is to use an asynchronous job worker like Mastodon's ThreadResolveWorker instead of occupying a task until the thread is fully resolved, iterative or not.

Maybe this would require the database schema to be aware of replies whose in_reply_to_id is yet to be resolved.

from kitsune.

aumetra avatar aumetra commented on September 28, 2024

Yeah, good point. But even if it's run in a background task, I'd personally prefer an iterative operation since it won't exhaust the stack space because of function calls

from kitsune.

aumetra avatar aumetra commented on September 28, 2024

Maybe this would require the database schema to be aware of replies whose in_reply_to_id is yet to be resolved

Not sure if we need that. We could just set that to NULL if we haven't resolved that and then just enqueue a new job to resolve the thread on initial fetch

from kitsune.

tesaguri avatar tesaguri commented on September 28, 2024

Yeah, good point. But even if it's run in a background task, I'd personally prefer an iterative operation since it won't exhaust the stack space because of function calls

I was assuming that the worker would only fetch a single post in a job and, well, recursively enqueue another job to the scheduler to fetch the reply until the thread is fully resolved, so that it won't exhaust the stack (and each job is reasonably short-lived). That's how Mastodon's worker is implemented IIUC.

We could just set that to NULL if we haven't resolved that and then just enqueue a new job to resolve the thread on initial fetch

Yes, I think we don't need this if we can hold a transaction over the whole thread resolution process, but otherwise, clients may observe a reply whose in_reply_to post haven't been resolved. Just making the in_reply_to_id to NULL in this case would make the client to recognise the post as a non-reply, which is not true.

Well, come to think of it, we don't keep a transaction over the whole process_new_object function today either, so this problem might not be inherent to the said worker approach anyway.

from kitsune.

Related Issues (20)

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.