Skip to content

Commit c7a425e

Browse files
authored
Merge pull request lowcoder-org#1079 from goldants/fix/expire
Fix 500 issue when cookie expires
2 parents dfaf965 + c5753c0 commit c7a425e

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/filter/UserSessionPersistenceFilter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.springframework.web.server.WebFilter;
2020
import org.springframework.web.server.WebFilterChain;
2121
import reactor.core.publisher.Mono;
22+
import reactor.core.scheduler.Schedulers;
2223

2324
import java.time.Instant;
2425
import java.util.Optional;
@@ -121,7 +122,8 @@ private Mono<User> refreshOauthToken(Triple<User, Connection, String> triple) {
121122
oAuth2RequestContext.setAuthConfig(findAuthConfig.authConfig());
122123

123124
return authRequestFactory.build(oAuth2RequestContext);
124-
}).flatMap(authRequest -> {
125+
})
126+
.publishOn(Schedulers.boundedElastic()).flatMap(authRequest -> {
125127
if(authRequest == null) {
126128
return Mono.just(user);
127129
}

server/api-service/lowcoder-server/src/main/java/org/lowcoder/runner/migrations/DatabaseChangelog.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.springframework.data.mongodb.core.query.Query;
4040
import org.springframework.data.mongodb.core.query.Update;
4141

42+
import java.time.Instant;
4243
import java.util.Set;
4344

4445
import static org.lowcoder.domain.util.QueryDslUtils.fieldName;
@@ -246,7 +247,31 @@ public void processDocument(Document document) {
246247
});
247248
}
248249

249-
@ChangeSet(order = "024", id = "add-gid-indexes-unique", author = "")
250+
@ChangeSet(order = "024", id = "fill-create-at", author = "")
251+
public void fillCreateAt(MongockTemplate mongoTemplate) {
252+
// Create a query to match all documents
253+
Query query = new Query();
254+
255+
// Use a DocumentCallbackHandler to iterate through each document
256+
mongoTemplate.executeQuery(query, "folder", new DocumentCallbackHandler() {
257+
@Override
258+
public void processDocument(Document document) {
259+
Object object = document.get("createdAt");
260+
if (object != null) return;
261+
// Create an update object to add the 'gid' field
262+
Update update = new Update();
263+
update.set("createdAt", Instant.now());
264+
265+
// Create a query to match the current document by its _id
266+
Query idQuery = new Query(Criteria.where("_id").is(document.getObjectId("_id")));
267+
268+
// Update the document with the new 'gid' field
269+
mongoTemplate.updateFirst(idQuery, update, "folder");
270+
}
271+
});
272+
}
273+
274+
@ChangeSet(order = "025", id = "add-gid-indexes-unique", author = "")
250275
public void addGidIndexesUnique(MongockTemplate mongoTemplate) {
251276
// collections to add gid
252277
String[] collectionNames = {"group", "organization"};

0 commit comments

Comments
 (0)