feat: daemon polls Gitea for new commits before sync_git_to_svn
This commit is contained in:
+1
-8
@@ -127,12 +127,5 @@ def fetch_from_gitea(mirror: Mirror, ref: Optional[str] = None) -> bool:
|
|||||||
timeout=300,
|
timeout=300,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check if anything changed
|
logger.debug("Fetch from Gitea complete")
|
||||||
out = _git("--git-dir", canonical, "rev-list", "--count",
|
|
||||||
f"HEAD..FETCH_HEAD", timeout=30, check=False)
|
|
||||||
if out and out.strip() != "0":
|
|
||||||
logger.info("Fetched new commits from Gitea")
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
logger.debug("No new commits from Gitea")
|
|
||||||
return False
|
|
||||||
|
|||||||
+2
-1
@@ -13,7 +13,7 @@ from typing import Dict, List, Optional, Tuple
|
|||||||
|
|
||||||
from .config import MirrorConfig
|
from .config import MirrorConfig
|
||||||
from .mirror import Mirror
|
from .mirror import Mirror
|
||||||
from .gitea import push_to_gitea, GiteaError
|
from .gitea import fetch_from_gitea, push_to_gitea, GiteaError
|
||||||
from .git_to_svn import sync_git_to_svn
|
from .git_to_svn import sync_git_to_svn
|
||||||
from .svn import (
|
from .svn import (
|
||||||
SVNPathChange,
|
SVNPathChange,
|
||||||
@@ -485,6 +485,7 @@ def run_daemon_loop(mirrors: Dict[str, Mirror]) -> None:
|
|||||||
svn_count = sync_all(m)
|
svn_count = sync_all(m)
|
||||||
if svn_count:
|
if svn_count:
|
||||||
push_to_gitea(m)
|
push_to_gitea(m)
|
||||||
|
fetch_from_gitea(m)
|
||||||
git_count = sync_git_to_svn(m)
|
git_count = sync_git_to_svn(m)
|
||||||
if svn_count or git_count:
|
if svn_count or git_count:
|
||||||
last_sync[mid] = now
|
last_sync[mid] = now
|
||||||
|
|||||||
Reference in New Issue
Block a user