Skip to content

Commit

Permalink
Remove returning default project and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Jan 12, 2024
1 parent 6c2c9ee commit b3a9327
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions server/projects/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func UpdateProject(

// GetProjectFromAPIKey returns a project from an API key.
func GetProjectFromAPIKey(ctx context.Context, be *backend.Backend, apiKey string) (*types.Project, error) {
// TODO(hackerwins): Default project without API key should be allowed only in standalone mode.
if apiKey == "" {
info, err := be.DB.FindProjectInfoByID(ctx, database.DefaultProjectID)
if err != nil {
Expand All @@ -110,14 +111,6 @@ func GetProjectFromAPIKey(ctx context.Context, be *backend.Backend, apiKey strin

// GetProjectFromSecretKey returns a project from a secret key.
func GetProjectFromSecretKey(ctx context.Context, be *backend.Backend, secretKey string) (*types.Project, error) {
if secretKey == "" {
info, err := be.DB.FindProjectInfoByID(ctx, database.DefaultProjectID)
if err != nil {
return nil, err
}
return info.ToProject(), nil
}

info, err := be.DB.FindProjectInfoBySecretKey(ctx, secretKey)
if err != nil {
return nil, err
Expand Down

1 comment on commit b3a9327

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Benchmark

Benchmark suite Current: b3a9327 Previous: d391669 Ratio
BenchmarkDocument/constructor_test - ns/op 1459 ns/op 1348 ns/op 1.08
BenchmarkDocument/constructor_test - B/op 1208 B/op 1208 B/op 1
BenchmarkDocument/constructor_test - allocs/op 20 allocs/op 20 allocs/op 1
BenchmarkDocument/status_test - ns/op 777.2 ns/op 774.9 ns/op 1.00
BenchmarkDocument/status_test - B/op 1176 B/op 1176 B/op 1
BenchmarkDocument/status_test - allocs/op 18 allocs/op 18 allocs/op 1
BenchmarkDocument/equals_test - ns/op 7048 ns/op 7095 ns/op 0.99
BenchmarkDocument/equals_test - B/op 6913 B/op 6913 B/op 1
BenchmarkDocument/equals_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/nested_update_test - ns/op 16035 ns/op 18023 ns/op 0.89
BenchmarkDocument/nested_update_test - B/op 11962 B/op 11963 B/op 1.00
BenchmarkDocument/nested_update_test - allocs/op 254 allocs/op 254 allocs/op 1
BenchmarkDocument/delete_test - ns/op 21809 ns/op 21860 ns/op 1.00
BenchmarkDocument/delete_test - B/op 15188 B/op 15188 B/op 1
BenchmarkDocument/delete_test - allocs/op 333 allocs/op 333 allocs/op 1
BenchmarkDocument/object_test - ns/op 8291 ns/op 8299 ns/op 1.00
BenchmarkDocument/object_test - B/op 6721 B/op 6721 B/op 1
BenchmarkDocument/object_test - allocs/op 116 allocs/op 116 allocs/op 1
BenchmarkDocument/array_test - ns/op 28848 ns/op 28416 ns/op 1.02
BenchmarkDocument/array_test - B/op 11819 B/op 11819 B/op 1
BenchmarkDocument/array_test - allocs/op 270 allocs/op 270 allocs/op 1
BenchmarkDocument/text_test - ns/op 30290 ns/op 30734 ns/op 0.99
BenchmarkDocument/text_test - B/op 14884 B/op 14795 B/op 1.01
BenchmarkDocument/text_test - allocs/op 468 allocs/op 468 allocs/op 1
BenchmarkDocument/text_composition_test - ns/op 28981 ns/op 28436 ns/op 1.02
BenchmarkDocument/text_composition_test - B/op 18398 B/op 18278 B/op 1.01
BenchmarkDocument/text_composition_test - allocs/op 477 allocs/op 477 allocs/op 1
BenchmarkDocument/rich_text_test - ns/op 79345 ns/op 79377 ns/op 1.00
BenchmarkDocument/rich_text_test - B/op 38645 B/op 38540 B/op 1.00
BenchmarkDocument/rich_text_test - allocs/op 1147 allocs/op 1147 allocs/op 1
BenchmarkDocument/counter_test - ns/op 16470 ns/op 16429 ns/op 1.00
BenchmarkDocument/counter_test - B/op 10210 B/op 10210 B/op 1
BenchmarkDocument/counter_test - allocs/op 236 allocs/op 236 allocs/op 1
BenchmarkDocument/text_edit_gc_100 - ns/op 2878592 ns/op 2870698 ns/op 1.00
BenchmarkDocument/text_edit_gc_100 - B/op 1658480 B/op 1655216 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 17092 allocs/op 17091 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 - ns/op 228722966 ns/op 227911236 ns/op 1.00
BenchmarkDocument/text_edit_gc_1000 - B/op 144397468 B/op 144348859 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 200989 allocs/op 200920 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 - ns/op 3368496 ns/op 3341420 ns/op 1.01
BenchmarkDocument/text_split_gc_100 - B/op 2316850 B/op 2313404 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 16193 allocs/op 16193 allocs/op 1
BenchmarkDocument/text_split_gc_1000 - ns/op 288745736 ns/op 284979132 ns/op 1.01
BenchmarkDocument/text_split_gc_1000 - B/op 228912464 B/op 228892912 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 203916 allocs/op 203950 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 - ns/op 10682365 ns/op 10649517 ns/op 1.00
BenchmarkDocument/text_delete_all_10000 - B/op 5810450 B/op 5809883 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40674 allocs/op 40671 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 - ns/op 183562826 ns/op 186393795 ns/op 0.98
BenchmarkDocument/text_delete_all_100000 - B/op 81901192 B/op 81904469 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411629 allocs/op 411644 allocs/op 1.00
BenchmarkDocument/text_100 - ns/op 226222 ns/op 216510 ns/op 1.04
BenchmarkDocument/text_100 - B/op 120107 B/op 118483 B/op 1.01
BenchmarkDocument/text_100 - allocs/op 5080 allocs/op 5080 allocs/op 1
BenchmarkDocument/text_1000 - ns/op 2425682 ns/op 2354446 ns/op 1.03
BenchmarkDocument/text_1000 - B/op 1169094 B/op 1153053 B/op 1.01
BenchmarkDocument/text_1000 - allocs/op 50084 allocs/op 50084 allocs/op 1
BenchmarkDocument/array_1000 - ns/op 1202010 ns/op 1167715 ns/op 1.03
BenchmarkDocument/array_1000 - B/op 1091216 B/op 1091275 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11825 allocs/op 11825 allocs/op 1
BenchmarkDocument/array_10000 - ns/op 13014624 ns/op 12925120 ns/op 1.01
BenchmarkDocument/array_10000 - B/op 9799951 B/op 9799997 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120290 allocs/op 120290 allocs/op 1
BenchmarkDocument/array_gc_100 - ns/op 147574 ns/op 143218 ns/op 1.03
BenchmarkDocument/array_gc_100 - B/op 132499 B/op 132500 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1248 allocs/op 1249 allocs/op 1.00
BenchmarkDocument/array_gc_1000 - ns/op 1383924 ns/op 1362603 ns/op 1.02
BenchmarkDocument/array_gc_1000 - B/op 1159053 B/op 1158952 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12865 allocs/op 12865 allocs/op 1
BenchmarkDocument/counter_1000 - ns/op 202342 ns/op 192998 ns/op 1.05
BenchmarkDocument/counter_1000 - B/op 192853 B/op 192852 B/op 1.00
BenchmarkDocument/counter_1000 - allocs/op 5765 allocs/op 5765 allocs/op 1
BenchmarkDocument/counter_10000 - ns/op 2158485 ns/op 2121356 ns/op 1.02
BenchmarkDocument/counter_10000 - B/op 2087767 B/op 2087765 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59772 allocs/op 59772 allocs/op 1
BenchmarkDocument/object_1000 - ns/op 1352215 ns/op 1323428 ns/op 1.02
BenchmarkDocument/object_1000 - B/op 1428051 B/op 1427932 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9845 allocs/op 9844 allocs/op 1.00
BenchmarkDocument/object_10000 - ns/op 14533547 ns/op 14952592 ns/op 0.97
BenchmarkDocument/object_10000 - B/op 12168528 B/op 12166471 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100565 allocs/op 100558 allocs/op 1.00
BenchmarkDocument/tree_100 - ns/op 1031140 ns/op 998783 ns/op 1.03
BenchmarkDocument/tree_100 - B/op 943676 B/op 943673 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6099 allocs/op 6099 allocs/op 1
BenchmarkDocument/tree_1000 - ns/op 74824468 ns/op 74036459 ns/op 1.01
BenchmarkDocument/tree_1000 - B/op 86460384 B/op 86460238 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60113 allocs/op 60112 allocs/op 1.00
BenchmarkDocument/tree_10000 - ns/op 9275920360 ns/op 9238843028 ns/op 1.00
BenchmarkDocument/tree_10000 - B/op 8580979704 B/op 8580993112 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600213 allocs/op 600251 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 - ns/op 75205832 ns/op 71588951 ns/op 1.05
BenchmarkDocument/tree_delete_all_1000 - B/op 86990435 B/op 86990417 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 67750 allocs/op 67750 allocs/op 1
BenchmarkDocument/tree_edit_gc_100 - ns/op 3702353 ns/op 3588143 ns/op 1.03
BenchmarkDocument/tree_edit_gc_100 - B/op 4120985 B/op 4120927 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 14356 allocs/op 14355 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - ns/op 308129356 ns/op 292095970 ns/op 1.05
BenchmarkDocument/tree_edit_gc_1000 - B/op 383465572 B/op 383466214 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 145401 allocs/op 145408 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 - ns/op 2546028 ns/op 2419488 ns/op 1.05
BenchmarkDocument/tree_split_gc_100 - B/op 2386878 B/op 2386838 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 10341 allocs/op 10341 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 - ns/op 184466206 ns/op 175905530 ns/op 1.05
BenchmarkDocument/tree_split_gc_1000 - B/op 221990510 B/op 221990052 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 112252 allocs/op 112245 allocs/op 1.00
BenchmarkRPC/client_to_server - ns/op 356719464 ns/op 345650310 ns/op 1.03
BenchmarkRPC/client_to_server - B/op 18090565 B/op 16395133 B/op 1.10
BenchmarkRPC/client_to_server - allocs/op 166914 allocs/op 166812 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server - ns/op 608577462 ns/op 599230474 ns/op 1.02
BenchmarkRPC/client_to_client_via_server - B/op 31647760 B/op 31200524 B/op 1.01
BenchmarkRPC/client_to_client_via_server - allocs/op 312534 allocs/op 312356 allocs/op 1.00
BenchmarkRPC/attach_large_document - ns/op 1335945518 ns/op 1320790007 ns/op 1.01
BenchmarkRPC/attach_large_document - B/op 1889229992 B/op 1889214992 B/op 1.00
BenchmarkRPC/attach_large_document - allocs/op 7556 allocs/op 7549 allocs/op 1.00
BenchmarkRPC/adminCli_to_server - ns/op 535167583 ns/op 524792658 ns/op 1.02
BenchmarkRPC/adminCli_to_server - B/op 35984004 B/op 35979672 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 289675 allocs/op 289662 allocs/op 1.00
BenchmarkLocker - ns/op 65.58 ns/op 64.08 ns/op 1.02
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel - ns/op 38.27 ns/op 37.88 ns/op 1.01
BenchmarkLockerParallel - B/op 0 B/op 0 B/op NaN
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkLockerMoreKeys - ns/op 147.4 ns/op 138.8 ns/op 1.06
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkChange/Push_10_Changes - ns/op 3771635 ns/op 3738509 ns/op 1.01
BenchmarkChange/Push_10_Changes - B/op 125941 B/op 127083 B/op 0.99
BenchmarkChange/Push_10_Changes - allocs/op 1254 allocs/op 1254 allocs/op 1
BenchmarkChange/Push_100_Changes - ns/op 14026078 ns/op 13951923 ns/op 1.01
BenchmarkChange/Push_100_Changes - B/op 649751 B/op 646730 B/op 1.00
BenchmarkChange/Push_100_Changes - allocs/op 6538 allocs/op 6540 allocs/op 1.00
BenchmarkChange/Push_1000_Changes - ns/op 112542338 ns/op 111633212 ns/op 1.01
BenchmarkChange/Push_1000_Changes - B/op 5995437 B/op 6052291 B/op 0.99
BenchmarkChange/Push_1000_Changes - allocs/op 62158 allocs/op 62156 allocs/op 1.00
BenchmarkChange/Pull_10_Changes - ns/op 2830292 ns/op 2807725 ns/op 1.01
BenchmarkChange/Pull_10_Changes - B/op 100804 B/op 101299 B/op 1.00
BenchmarkChange/Pull_10_Changes - allocs/op 952 allocs/op 951 allocs/op 1.00
BenchmarkChange/Pull_100_Changes - ns/op 4281628 ns/op 4259998 ns/op 1.01
BenchmarkChange/Pull_100_Changes - B/op 258351 B/op 259044 B/op 1.00
BenchmarkChange/Pull_100_Changes - allocs/op 3154 allocs/op 3154 allocs/op 1
BenchmarkChange/Pull_1000_Changes - ns/op 8272246 ns/op 8186496 ns/op 1.01
BenchmarkChange/Pull_1000_Changes - B/op 1399154 B/op 1399630 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 26871 allocs/op 26877 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 16590888 ns/op 16788712 ns/op 0.99
BenchmarkSnapshot/Push_3KB_snapshot - B/op 810478 B/op 814611 B/op 0.99
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6543 allocs/op 6542 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 116463324 ns/op 116153491 ns/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot - B/op 6128999 B/op 6295727 B/op 0.97
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 62172 allocs/op 62346 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6591117 ns/op 6588486 ns/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 906098 B/op 908101 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 14881 allocs/op 14882 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 14626717 ns/op 14361476 ns/op 1.02
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 6980229 B/op 6995643 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 144141 allocs/op 144141 allocs/op 1
BenchmarkSync/memory_sync_10_test - ns/op 6728 ns/op 6687 ns/op 1.01
BenchmarkSync/memory_sync_10_test - B/op 1286 B/op 1286 B/op 1
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test - ns/op 50976 ns/op 52081 ns/op 0.98
BenchmarkSync/memory_sync_100_test - B/op 8655 B/op 8642 B/op 1.00
BenchmarkSync/memory_sync_100_test - allocs/op 274 allocs/op 273 allocs/op 1.00
BenchmarkSync/memory_sync_1000_test - ns/op 586160 ns/op 587862 ns/op 1.00
BenchmarkSync/memory_sync_1000_test - B/op 74531 B/op 74357 B/op 1.00
BenchmarkSync/memory_sync_1000_test - allocs/op 2120 allocs/op 2110 allocs/op 1.00
BenchmarkSync/memory_sync_10000_test - ns/op 7177383 ns/op 6961544 ns/op 1.03
BenchmarkSync/memory_sync_10000_test - B/op 749699 B/op 764082 B/op 0.98
BenchmarkSync/memory_sync_10000_test - allocs/op 20370 allocs/op 20603 allocs/op 0.99
BenchmarkTextEditing - ns/op 18425902695 ns/op 18032931695 ns/op 1.02
BenchmarkTextEditing - B/op 9041635688 B/op 9038055344 B/op 1.00
BenchmarkTextEditing - allocs/op 19921383 allocs/op 19923783 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.