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

[replit] The lesser of two evils #167

Merged
merged 5 commits into from
Feb 27, 2024

Commits on Feb 24, 2024

  1. [replit] The lesser of two evils

    Currently the replit library has a very gross quirk: it has a global in
    `replit.database.default_db.db`, and the mere action of importing this
    library causes side effects to run! (connects to the database, starts a
    thread to refresh the URL, and prints a warning to stdout, adding insult
    to injury).
    
    So we're trading that very gross quirk with a gross workaround to
    preserve backwards compatibility: the modules that somehow end up
    importing that module now have a `__getattr__` that _lazily_ calls the
    code that used to be invoked as a side-effect of importing the library.
    Maybe in the future we'll deploy a breaking version of the library where
    we're not beholden to this backwards-compatibility quirck.
    lhchavez authored and blast-hardcheese committed Feb 24, 2024
    Configuration menu
    Copy the full SHA
    1aeeb18 View commit details
    Browse the repository at this point in the history
  2. Marking internal properties as private

    Providing accessors, to hint that we are accessing mutable state
    blast-hardcheese committed Feb 24, 2024
    Configuration menu
    Copy the full SHA
    a34c321 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e628478 View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2024

  1. Reflow LazyDB back down into default_db module

    An issue with LazyDB is that the refresh_db timer would not get canceled
    if the user closes the database.
    
    Additionally, the db_url refresh logic relies on injection, whereas the Database should ideally be the thing requesting that information from the environment
    blast-hardcheese committed Feb 26, 2024
    Configuration menu
    Copy the full SHA
    5be6253 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e4d5a02 View commit details
    Browse the repository at this point in the history