The first time https://pubky.app is opened, it fetches certain data to bootstrap the app, using /v0/bootstrap/{user_id} in the Nexus API.
The same data can be fetched by firing different other calls, like "fetch posts" + "fetch hot tags" + "fetch user details" + "fetch tag counts" etc, but the goal of this endpoint is to avoid this and simplify the bootstrapping of the app.
The issue is described in this TODO:
|
// TODO: If the user list is too big, we could do in batches |
However there is a better and simpler solution than the proposed batching, namely limiting the max number (in this case of UserViews).
Please address the above TODO by limiting the max number of users and posts a Bootstrap object can contain.
|
pub struct Bootstrap { |
|
/// The user objects shown to the given user ID |
|
pub users: UserStream, |
|
/// The posts objects shown to the given user ID |
|
pub posts: PostStream, |
|
/// IDs of objects shown to this user on the home page of the FE |
|
pub ids: BootstrapIds, |
|
/// Whether or not this user is already indexed |
|
pub indexed: bool, |
|
} |
The idea is the Bootstrap payload should not be allowed to be that big that a few simple DB lookups cannot handle, but still big enough that it is useful for bootstrapping Pubky App.
To achieve this, introduce some limits, similarly to how it's done for other API endpoints, like
|
const MAX_POSTS: usize = 100; |
The first time https://pubky.app is opened, it fetches certain data to bootstrap the app, using
/v0/bootstrap/{user_id}in the Nexus API.The same data can be fetched by firing different other calls, like "fetch posts" + "fetch hot tags" + "fetch user details" + "fetch tag counts" etc, but the goal of this endpoint is to avoid this and simplify the bootstrapping of the app.
The issue is described in this
TODO:pubky-nexus/nexus-common/src/models/bootstrap.rs
Line 209 in 4a0163f
However there is a better and simpler solution than the proposed batching, namely limiting the max number (in this case of
UserViews).Please address the above
TODOby limiting the max number ofusersandpostsaBootstrapobject can contain.pubky-nexus/nexus-common/src/models/bootstrap.rs
Lines 26 to 35 in 4a0163f
The idea is the
Bootstrappayload should not be allowed to be that big that a few simple DB lookups cannot handle, but still big enough that it is useful for bootstrapping Pubky App.To achieve this, introduce some limits, similarly to how it's done for other API endpoints, like
pubky-nexus/nexus-webapi/src/routes/v0/stream/posts.rs
Line 221 in 4a0163f