Skip to content

Commit 9b70932

Browse files
committed
Merge branch 'main' into simulot/issue215
2 parents 49bf673 + 734bbeb commit 9b70932

File tree

3 files changed

+75
-17
lines changed

3 files changed

+75
-17
lines changed

browser/gp/googlephotos.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ type walkerCatalog map[string]directoryCatalog // by directory in the walker
3232

3333
// directoryCatalog captures all files in a given directory
3434
type directoryCatalog struct {
35-
files map[string]fileInfo // map of fileInfo by base name
35+
unMatchedFiles map[string]fileInfo // map of fileInfo by base name
36+
matchedFiles map[string]fileInfo // map of fileInfo by base name
3637
}
3738

3839
// fileInfo keep information collected during pass one
@@ -107,8 +108,11 @@ func (to *Takeout) passOneFsWalk(ctx context.Context, w fs.FS) error {
107108
}
108109

109110
dirCatalog := to.catalogs[w][dir]
110-
if dirCatalog.files == nil {
111-
dirCatalog.files = map[string]fileInfo{}
111+
if dirCatalog.unMatchedFiles == nil {
112+
dirCatalog.unMatchedFiles = map[string]fileInfo{}
113+
}
114+
if dirCatalog.matchedFiles == nil {
115+
dirCatalog.matchedFiles = map[string]fileInfo{}
112116
}
113117
finfo, err := d.Info()
114118
if err != nil {
@@ -151,7 +155,7 @@ func (to *Takeout) passOneFsWalk(ctx context.Context, w fs.FS) error {
151155
case immich.TypeImage:
152156
to.log.Record(ctx, fileevent.DiscoveredImage, nil, name)
153157
}
154-
dirCatalog.files[base] = fileInfo{
158+
dirCatalog.unMatchedFiles[base] = fileInfo{
155159
length: int(finfo.Size()),
156160
}
157161
}
@@ -240,19 +244,17 @@ func (to *Takeout) solvePuzzle(ctx context.Context) error {
240244
for d := range paths {
241245
for _, w := range to.fsyss {
242246
l := to.catalogs[w][d]
243-
for f := range l.files {
247+
for f := range l.unMatchedFiles {
244248
select {
245249
case <-ctx.Done():
246250
return ctx.Err()
247251
default:
248-
if l.files[f].md == nil {
249-
if matcher(k.name, f, to.sm) {
250-
// if not already matched
251-
i := l.files[f]
252-
i.md = md
253-
l.files[f] = i
254-
to.log.Record(ctx, fileevent.AnalysisAssociatedMetadata, l.files[f], f)
255-
}
252+
if matcher(k.name, f, to.sm) {
253+
i := l.unMatchedFiles[f]
254+
i.md = md
255+
l.matchedFiles[f] = i
256+
delete(l.unMatchedFiles, f)
257+
to.log.Record(ctx, fileevent.AnalysisAssociatedMetadata, l.unMatchedFiles[f], f)
256258
}
257259
}
258260
}
@@ -427,7 +429,7 @@ func (to *Takeout) passTwoWalk(ctx context.Context, w fs.FS, assetChan chan *bro
427429
if !to.sm.IsMedia(ext) {
428430
return nil
429431
}
430-
f, exist := to.catalogs[w][dir].files[base]
432+
f, exist := to.catalogs[w][dir].matchedFiles[base]
431433
if !exist {
432434
return nil
433435
}
@@ -459,7 +461,7 @@ func (to *Takeout) passTwoWalk(ctx context.Context, w fs.FS, assetChan chan *bro
459461
select {
460462
case <-ctx.Done():
461463
return ctx.Err()
462-
case assetChan <- a: // the consumer must call a.File.Release()
464+
case assetChan <- a:
463465
to.uploaded[key] = nil // remember we have seen this file already
464466
}
465467
return nil

docs/releases.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
## Release next
44

5+
### fix [#215](https://github.com/simulot/immich-go/issues/215) Use XDG_CONFIG_HOME for storing config
6+
The configuration file that contains the server and the key is now stored by default in following folder:
7+
- Linux `$HOME/.config/immich-go/immich-go.json`
8+
- Windows `%AppData%\immich-go\immich-go.json`
9+
- Apple `$HOME/Library/Application Support/immich-go/immich-go.json`
10+
11+
### Store the log files into sensible dir for user's system
12+
The default log file is:
13+
- Linux `$HOME/.cache/immich-go/immich-go_YYYY-MM-DD_HH-MI-SS.log`
14+
- Windows `%LocalAppData%\immich-go\immich-go_YYYY-MM-DD_HH-MI-SS.log`
15+
- Apple `$HOME/Library/Caches/immich-go/immich-go_YYYY-MM-DD_HH-MI-SS.log`
16+
17+
### Feat: [[#249](https://github.com/simulot/immich-go/issues/249)] Fix Display the path of log file name
18+
19+
The log file's name is displayed at exection end.
20+
21+
522
### Fix Display the path of log file name
623

724
The log file name is printed before the execution end.
@@ -18,6 +35,36 @@ The default log file is:
1835
- Windows `%LocalAppData%\immich-go\immich-go_YYYY-MM-DD_HH-MI-SS.log`
1936
- Apple `$HOME/Library/Caches/immich-go/immich-go_YYYY-MM-DD_HH-MI-SS.log`
2037

38+
## Release next
39+
40+
<<<<<<< HEAD
41+
### Fix Display the path of log file name
42+
43+
The log file name is printed before the execution end.
44+
45+
### Fix [#215](https://github.com/simulot/immich-go/issues/215) Use XDG_CONFIG_HOME for storing config
46+
=======
47+
### fix [#215](https://github.com/simulot/immich-go/issues/215) Use XDG_CONFIG_HOME for storing config
48+
>>>>>>> origin/main
49+
The configuration file that contains the server and the key is now stored by default in following folder:
50+
- Linux `$HOME/.config/immich-go/immich-go.json`
51+
- Windows `%AppData%\immich-go\immich-go.json`
52+
- Apple `$HOME/Library/Application Support/immich-go/immich-go.json`
53+
54+
### Store the log files into sensible dir for user's system
55+
The default log file is:
56+
- Linux `$HOME/.cache/immich-go/immich-go_YYYY-MM-DD_HH-MI-SS.log`
57+
- Windows `%LocalAppData%\immich-go\immich-go_YYYY-MM-DD_HH-MI-SS.log`
58+
- Apple `$HOME/Library/Caches/immich-go/immich-go_YYYY-MM-DD_HH-MI-SS.log`
59+
60+
<<<<<<< HEAD
61+
=======
62+
### Feat: [[#249](https://github.com/simulot/immich-go/issues/249)] Fix Display the path of log file name
63+
64+
The log file's name is displayed at exection end.
65+
66+
67+
>>>>>>> origin/main
2168
## Release 0.14.1
2269

2370
### fix [#246](https://github.com/simulot/immich-go/issues/246) Google Takeout 403 Forbidden on non admin user

immich/client.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,19 @@ func NewImmichClient(endPoint string, key string, sslVerify bool) (*ImmichClient
5252
}
5353

5454
// Create a custom HTTP client with SSL verification disabled
55+
// Add timeouts for #219
56+
// Info at https://www.loginradius.com/blog/engineering/tune-the-go-http-client-for-high-performance/
5557
transportOptions := &http.Transport{
56-
TLSClientConfig: &tls.Config{InsecureSkipVerify: sslVerify},
58+
MaxIdleConns: 100,
59+
IdleConnTimeout: 90 * time.Second,
60+
TLSClientConfig: &tls.Config{InsecureSkipVerify: sslVerify},
61+
MaxIdleConnsPerHost: 100,
62+
MaxConnsPerHost: 100,
63+
}
64+
tlsClient := &http.Client{
65+
Timeout: time.Second * 10,
66+
Transport: transportOptions,
5767
}
58-
tlsClient := &http.Client{Transport: transportOptions}
5968

6069
ic := ImmichClient{
6170
endPoint: endPoint + "/api",

0 commit comments

Comments
 (0)