Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: client-twitter - character card profiles are cached into database indefinitely #1638

Open
augchan42 opened this issue Jan 1, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@augchan42
Copy link
Contributor

augchan42 commented Jan 1, 2025

We should not be caching character card into the database indefinitely
Around line 725 in base.ts:

async cacheProfile(profile: TwitterProfile) {
    await this.runtime.cacheManager.set(
        `twitter/${profile.username}/profile`,
        profile
    ); // No expiry - profile persists
}

That means once the profile is cached, even if the character card info is changed and agent process is restarted, the cached profile from the database is used. This should be removed so that character card bios can be updated upon restart. There's not much of a performance gain from caching anyway, as the bio is only loaded once on startup.

twitter login Cookies are also cached indefinitely, not sure if that's good or bad, but it doesn't seem right to me as twitter login cookies should eventually expire.

@augchan42 augchan42 added the bug Something isn't working label Jan 1, 2025
@AIFlowML
Copy link
Contributor

AIFlowML commented Jan 3, 2025

We can Modify the cacheProfile function to include an expiration time. This can be done by adding an additional parameter to the set method that specifies the time-to-live (TTL) for the cache entry. For example:

async cacheProfile(profile: TwitterProfile) {
    const ttl = 3600; // Set TTL to 1 hour (3600 seconds)
    await this.runtime.cacheManager.set(
        `twitter/${profile.username}/profile`,
        profile,
        { ttl }
    );
}

But this wil not change the cached stuff.
Worth a look in. Nice catch.

@augchan42
Copy link
Contributor Author

augchan42 commented Jan 3, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants