22// create a repository object
33function createRepoObj ( fullName , selBranch , defaultBranch ,
44 pushAccess , branches , private ,
5- isFork , empty ) {
5+ isFork , empty ,
6+ repoDataExpiration , branchExpiration ) {
67
78 return {
89 fullName,
@@ -12,7 +13,9 @@ function createRepoObj(fullName, selBranch, defaultBranch,
1213 branches,
1314 private,
1415 isFork,
15- empty
16+ empty,
17+ repoDataExpiration,
18+ branchExpiration,
1619 }
1720
1821}
@@ -86,6 +89,22 @@ function updateModRepoEmptyStatus(fullName, empty) {
8689
8790}
8891
92+ function updateModRepoDataExpiration ( fullName , time ) {
93+
94+ modifiedRepos [ fullName ] . repoDataExpiration = time ;
95+
96+ updateModReposLS ( ) ;
97+
98+ }
99+
100+ function updateModRepoBranchExpiration ( fullName , time ) {
101+
102+ modifiedRepos [ fullName ] . branchExpiration = time ;
103+
104+ updateModReposLS ( ) ;
105+
106+ }
107+
89108
90109
91110// get repo obj from git
@@ -102,7 +121,7 @@ async function fetchRepoAndSaveToModRepos(treeLoc) {
102121
103122 // create temporary repo object
104123 const tempRepoObj = createRepoObj ( fullName , selBranch , null ,
105- null , null , null , null , null ) ;
124+ null , null , null , null , null , 0 , 0 ) ;
106125
107126 // add temp repo object
108127 // to modified repos
@@ -127,6 +146,16 @@ async function fetchRepoAndSaveToModRepos(treeLoc) {
127146 // check temp repo changed
128147 const tempRepo = modifiedRepos [ fullName ] ;
129148
149+
150+ // get repo data expiration time
151+ // (two months from now)
152+
153+ let expirationDate = new Date ( ) ;
154+ expirationDate . setDate ( expirationDate . getDate ( ) + ( 2 * 4 * 7 ) ) ;
155+
156+ const twoMonthsTime = expirationDate . getTime ( ) ;
157+
158+
130159 // create repo obj
131160 const repoObj = createRepoObj ( fullName ,
132161
@@ -140,7 +169,11 @@ async function fetchRepoAndSaveToModRepos(treeLoc) {
140169
141170 repo . private , repo . fork ,
142171
143- ( tempRepo . empty ?? false ) ) ;
172+ ( tempRepo . empty ?? false ) ,
173+
174+ twoMonthsTime ,
175+
176+ ( tempRepo . branchExpiration ?? 0 ) ;
144177
145178 // add repo object
146179 // to modified repos
0 commit comments