nocobase-app-plugin-concurrency
하는 일
이 스킬은 NocoBase 3 앱의 프로세스 로컬 잠금 서비스를 설정합니다. 두 작업이 같은 것을 동시에 바꾸지 않도록 막아야 하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓두 요청이 같은 레코드를 동시에 바꿀 수 있을 때.
- ✓NocoBase 서버 코드에 이름이 있는 잠금이 필요할 때.
- ✓애플리케이션 설정 파일에서 잠금 설정을 구성하고 싶을 때.
스킬 링크
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-concurrency/skills/nocobase-app-plugin-concurrency/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“두 사용자가 재고 업데이트를 동시에 실행하지 못하도록 제 NocoBase 앱에 잠금을 추가해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 동시성 플러그인을 등록하고, 설정에 이름이 있는 잠금 관리자를 구성하며, 잠금이 필요한 코드에서 잠금 서비스를 사용합니다. 이 잠금은 실행 중인 하나의 프로세스 안에서 작동합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Concurrency
Install and register
Install @nocobase/app-plugin-concurrency with compatible application-supplied @nocobase/app-server, @nocobase/service-provider and @nocobase/concurrency peers. Register the default /server definition before business plugins and register defineConcurrencyConfig() from /config under concurrency. Installation and both registrations are separate requirements.
The factory supplies default: memory and memory.adapter: mutex, declares CONCURRENCY_DEFAULT and exposes no browser fields. Entry fields are adapter, optional namespace (application name by default), optional ttl, and implementation-owned connection. Mutex forbids connection. TTL is a renewable lease duration, an integer from 1 through 2147483647 milliseconds. Local Mutex accepts and validates TTL but ignores it, with no holding timer, expiration release or local renewal. Resource TTL overrides configuration TTL; undefined retains configuration TTL. Unknown options and invalid selectors fail. Entries do not inherit from one another. Two enabled local entries cannot share a namespace.
Consume the original service
import { concurrencyServiceToken } from '@nocobase/app-plugin-concurrency/server';
const service = app.container.resolve(concurrencyServiceToken);
// Obtain managers in ready or normal running work.
const manager = await service.getManager();
const executor = await manager.createSynchronous('orders:sync');
const result = await executor.tryRun(async () => 'done', 500);
Inject the owner-created Token; never create a second Token or service. The same configuration name shares one manager. Same-name Lock and Executor handles compete in the same domain regardless of TTL. Use bounded, stable resource names: the local native Mutex table remains until instance shutdown. Local locks coordinate only within that instance, never across processes.
lock and run wait without a deadline until success, cancellation or failure. Omitted/zero positional try budgets use native tryAcquire, including its zero-millisecond timer window. Positive try budgets use native withTimeout, not a precise return deadline. Busy results come only from explicit native non-acquisition. Capture each call's signal once; cancellation before delivery must not affect other waiters. Cancellation after delivery does not release a Lease or stop a runner. Late native success after cancellation is released using its own releaser without delivery, runner execution or TTL timer.
Lease release is asynchronous and idempotent; concurrent calls share a result and failures permit explicit retry on the same handle while its instance remains usable. Executors combine Lock acquisition with a no-argument runner, wait for actual runner settlement and diagnose cleanup failure without replacing business values or exceptions. Local Mutex remains held beyond an explicit TTL until manual release, actual runner settlement or instance shutdown. TTL is not a runner timeout or a validity guarantee. Redis implementations use native automatic renewal for both Lock and Executor, not an Executor-owned renewal loop. Use application transactions and idempotency where required.
Lifecycle and extensions
The Provider owns initialization and shutdown. Default startup is eager; named configurations initialize lazily and concurrently share one initialization. Boot freezes the complete snapshot, including unused entries. Reload requires restart to apply changes and never changes active or lazy domains.
Applications stop dependent business work before Concurrency shutdown. Shutdown rejects new acquisitions, interrupts waits, observes issued native requests and actively releases confirmed Leases without draining runners. Release failures are diagnosed while cleanup continues. Concurrent shutdown shares a Promise and successful shutdown is idempotent. Failed owned-resource closure retains its handle for explicit owner service.shutdown() retry. A second app.shutdown() does not repeat cached Provider shutdown. No public operation, cleanup or overall shutdown deadline is configured.
Implementation authors use /server: ManagedLeaseRegistry, startAcquire, createSynchronousExecutor, encodeResourceKey and the original implementation/configuration types. The registry registers confirmed releasers synchronously and owns only Lease release and record disposal, not acquisition, pending work, TTL or renewal. `startAcquire(registry, { si
자주 묻는 질문
잠금이 여러 서버에 걸쳐 작동하나요?
로컬 잠금은 한 프로세스 안에서만 작동하며, 스킬은 그 한계를 설명합니다.
잠금에 제한 시간을 줄 수 있나요?
생존 시간 설정은 받아들여지지만, 로컬 잠금은 이를 사용하지 않습니다.
잠금이 데이터베이스에 저장되나요?
아니요. 애플리케이션 프로세스 안의 잠금 서비스입니다.
상세 정보
작성자의 원본 설명
Configure and consume NocoBase 3 process-local Mutex locks, strict named managers, original service Token, optional TTL, public implementation extensions and application-owned shutdown.
repo: nocobase/nocobase
인기도
- GitHub 스타
- 25k
- 순위
- #10094
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
nocobase-app-development
25k에이전트가 완전한 NocoBase 3 업무 애플리케이션을 위해 페이지, 라우트, 데이터, 권한, 테스트를 만들도록 돕습니다.
shadcn
25k에이전트가 웹 프로젝트에서 공식 문서와 레지스트리를 사용해 shadcn/ui 컴포넌트를 찾고, 추가하고, 고치고, 스타일을 입히도록 돕습니다.
nocobase-app-plugin-development
25k에이전트가 기존 NocoBase 3 앱 안에서 서버, 클라이언트, 데이터베이스, 등록 부분을 포함한 플러그인을 만들고 관리하도록 돕습니다.
nocobase-app-upgrade
25k에이전트가 NocoBase 앱을 더 새로운 템플릿 릴리스로 업그레이드하고, 사용자의 작업을 지키면서 템플릿 변경을 가져오도록 돕습니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.