mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
refactor: Improve SQLite cache error handling and import organization
This commit is contained in:
parent
0feed0047c
commit
ef0fcb8f38
1 changed files with 2 additions and 3 deletions
|
@ -2,6 +2,7 @@ import colorsys
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import shutil
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -168,7 +169,7 @@ class RepoMap:
|
||||||
|
|
||||||
def tags_cache_error(self):
|
def tags_cache_error(self):
|
||||||
"""Handle SQLite errors by trying to recreate cache, falling back to dict if needed"""
|
"""Handle SQLite errors by trying to recreate cache, falling back to dict if needed"""
|
||||||
if not isinstance(self.TAGS_CACHE, Cache):
|
if isinstance(getattr(self, "TAGS_CACHE", None), dict):
|
||||||
return
|
return
|
||||||
|
|
||||||
path = Path(self.root) / self.TAGS_CACHE_DIR
|
path = Path(self.root) / self.TAGS_CACHE_DIR
|
||||||
|
@ -177,8 +178,6 @@ class RepoMap:
|
||||||
try:
|
try:
|
||||||
# Delete existing cache dir
|
# Delete existing cache dir
|
||||||
if path.exists():
|
if path.exists():
|
||||||
import shutil
|
|
||||||
|
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
|
||||||
# Try to create new cache
|
# Try to create new cache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue